Fix regression insert by exclude option
This commit is contained in:
parent
de14f239ed
commit
2e1551f426
1 changed files with 17 additions and 8 deletions
|
|
@ -163,11 +163,16 @@ class GenericMuninPlugin(object):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def monitored(self, result):
|
def monitored(self, result):
|
||||||
id = '%s@%s' % (getattr(result, self.attribid), result.backend)
|
id = self.result2weboobid(result)
|
||||||
if self.exclude and id in self.exclude:
|
if self.exclude and id in self.exclude:
|
||||||
return False
|
return False
|
||||||
return not self.tomonitore or id in self.tomonitore
|
return not self.tomonitore or id in self.tomonitore
|
||||||
|
|
||||||
|
def result2weboobid(self, result):
|
||||||
|
attribs = self.attribid.split('/')
|
||||||
|
id = '%s@%s' % (getattr(result, attribs[0]), result.backend)
|
||||||
|
return id
|
||||||
|
|
||||||
def result2id(self, result):
|
def result2id(self, result):
|
||||||
attribs = self.attribid.split('/')
|
attribs = self.attribid.split('/')
|
||||||
id = result
|
id = result
|
||||||
|
|
@ -188,17 +193,21 @@ class GenericMuninPlugin(object):
|
||||||
self.write_output('graph_args -l 0')
|
self.write_output('graph_args -l 0')
|
||||||
try:
|
try:
|
||||||
objects = []
|
objects = []
|
||||||
if self.tomonitore is not None or self.exclude is not None:
|
if self.tomonitore or self.exclude:
|
||||||
d = {}
|
d = {}
|
||||||
for backend, result in self.build_do():
|
for backend, result in self.build_do():
|
||||||
if self.monitored(result):
|
if self.monitored(result):
|
||||||
d['%s@%s' % (self.result2id(result), result.backend)] = result
|
d[self.result2weboobid(result)] = result
|
||||||
|
|
||||||
for id in self.tomonitore:
|
if self.tomonitore:
|
||||||
try:
|
for id in self.tomonitore:
|
||||||
|
try:
|
||||||
|
objects.append(d[id])
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
for id in d:
|
||||||
objects.append(d[id])
|
objects.append(d[id])
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
objects = reversed([a for b, a in self.build_do()])
|
objects = reversed([a for b, a in self.build_do()])
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue