Skip to content
Browse files

workaround "root" field name bug

2.0 master has a bug that makes a field named "root" not allowed anymore.
This commit is a workaround in order for these graphs to be displayed again.

Proper resolution is due in master, not in the plugins. But patch is much more
invasive. So delaying it to 2.1.
  • Loading branch information...
1 parent 4693bc3 commit 5774c17c6a0bb0249ccc1a86f51926973238a34e @steveschnepp steveschnepp committed Jun 27, 2012
Showing with 6 additions and 2 deletions.
  1. +3 −0 plugins/lib/Munin/Plugin.pm
  2. +3 −2 plugins/plugin.sh.in
View
3 plugins/lib/Munin/Plugin.pm
@@ -167,6 +167,9 @@ sub clean_fieldname ($) {
# Replace remaining illegals with _
$name =~ s/[^A-Za-z0-9_]/_/g;
+ # "root" is *not* allowed due to a 2.0 bug
+ $name = "__root" if $name eq "root";
+
return $name;
}
View
5 plugins/plugin.sh.in
@@ -9,8 +9,9 @@ clean_fieldname () {
# very much still break munin.
#
# usage: name="$(clean_fieldname "$item")"
- #
- echo "$@" | sed -e 's/^[^A-Za-z_]/_/' -e 's/[^A-Za-z0-9_]/_/g'
+
+ # "root" is *not* allowed due to a 2.0 bug
+ echo "$@" | sed -e 's/^[^A-Za-z_]/_/' -e 's/[^A-Za-z0-9_]/_/g' -e 's/^root$/__root/'
}

0 comments on commit 5774c17

Please sign in to comment.
Something went wrong with that request. Please try again.