Take the first element of an list

And fix encoding issue
This commit is contained in:
Florent 2013-03-01 20:27:28 +01:00 committed by Romain Bignon
commit 35b1df511a

View file

@ -155,6 +155,8 @@ class GenericMuninPlugin(object):
attribs = self.attribvalue.split('/')
for attrib in attribs:
result = getattr(result, attrib)
if type(result) is list:
result = result[0]
return result
def monitored(self, result):
@ -201,7 +203,7 @@ class GenericMuninPlugin(object):
if first:
type = 'AREA'
first = False
self.write_output('%s.label %s' % (id, getattr(result, self.attriblabel).encode('iso-8859-15')))
self.write_output('%s.label %s' % (id.encode('iso-8859-15'), getattr(result, self.attriblabel).encode('iso-8859-15')))
if self.cumulate:
self.write_output('%s.draw %s' % (id, type))
except CallErrors, errors: