munin plugin suppresses numbers from VM names

Bug #534397 reported by Bernie Innocenti
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
virt-goodies (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: virt-goodies

The valid regex should be [A-Za-z0-9_] (with numbers included).

Also, the entire canonicalize() function could be replaced with just one
line:

  tr/A-Za-z0-9/_/c

or even

  s/[^A-Za-z0-9]/_/g

Perl's eclecticism :-)

Revision history for this message
Soren Hansen (soren) wrote : Re: [Bug 534397] [NEW] munin plugin suppresses numbers from VM names

On Mon, Mar 08, 2010 at 02:02:14PM -0000, Bernie Innocenti wrote:
> The valid regex should be [A-Za-z0-9_] (with numbers included).

Not exactly. According to

   http://munin-monitoring.org/wiki/notes_on_datasource_names

these two should do it:

s/^[^A-Za-z_]/_/
s/[^A-Za-z0-9_]/_/g

> Also, the entire canonicalize() function could be replaced with just one
> line:
>
> tr/A-Za-z0-9/_/c
>
> or even
>
> s/[^A-Za-z0-9]/_/g
>
>
> Perl's eclecticism :-)

Well, yeah, except this is Python :)

--
Soren Hansen
Ubuntu Developer
http://www.ubuntu.com/

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package virt-goodies - 0.4

---------------
virt-goodies (0.4) lucid; urgency=low

  * Properly unquote strings when vmx file uses DOS linefeeds. (LP: #246841)
    Thanks to Tor Hveem for the patch.
  * Make canonicalise in libvirt-munin act according to munin's
    documentation. (LP: #534397)
 -- Soren Hansen <email address hidden> Mon, 08 Mar 2010 20:49:34 +0100

Changed in virt-goodies (Ubuntu):
status: New → Fix Released
Revision history for this message
Bernie Innocenti (codewiz) wrote :

On Mon, 2010-03-08 at 19:53 +0000, Soren Hansen wrote:
> > Perl's eclecticism :-)
>
> Well, yeah, except this is Python :)

Oh, my... I must have been SO drunk to confuse Perl with Python.
But, wait: one could reach a similar level of conciseness even in
Python:

  re.sub(r"[^A-Za-z0-9]", "_", foo)

--
   // Bernie Innocenti - http://codewiz.org/
 \X/ Sugar Labs - http://sugarlabs.org/

Revision history for this message
Soren Hansen (soren) wrote :

On Wed, Mar 10, 2010 at 03:32:13AM -0000, Bernie Innocenti wrote:
> one could reach a similar level of conciseness even in Python:
>
> re.sub(r"[^A-Za-z0-9]", "_", foo)

No. The first character cannot be a numeral as per

   http://munin-monitoring.org/wiki/notes_on_datasource_names

--
Soren Hansen
Ubuntu Developer
http://www.ubuntu.com/

Revision history for this message
Bernie Innocenti (codewiz) wrote :

On Wed, 2010-03-10 at 10:09 +0000, Soren Hansen wrote:
> On Wed, Mar 10, 2010 at 03:32:13AM -0000, Bernie Innocenti wrote:
> > one could reach a similar level of conciseness even in Python:
> >
> > re.sub(r"[^A-Za-z0-9]", "_", foo)
>
> No. The first character cannot be a numeral as per
>
> http://munin-monitoring.org/wiki/notes_on_datasource_names

Oh, right. Then... hmmm... we could use two alternate patterns:

 re.sub(r"^[^A-Za-z]|[^A-Za-z0-9]", "_", foo)

--
   // Bernie Innocenti - http://codewiz.org/
 \X/ Sugar Labs - http://sugarlabs.org/

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.