Refactor return code search, new function

Signed-off-by: Sven Velt <sven@velt.de>
This commit is contained in:
Sven Velt 2011-01-25 12:43:52 +01:00
parent e0a860273c
commit 619ce45d73

View file

@ -306,11 +306,17 @@ class MonitoringPlugin(object):
print 'V' + str(level) + ': ' + output print 'V' + str(level) + ': ' + output
def exit(self): def max_returncode(self, returncodes):
for returncode in self.returncode_priority: for rc in self.returncode_priority:
if returncode in self.__returncode: if rc in returncodes:
break break
return rc
def exit(self):
returncode = self.max_returncode(self.__returncode)
self.back2nagios(returncode, statusline=self.__output, multiline=self.__multilineoutput, performancedata=self.__performancedata) self.back2nagios(returncode, statusline=self.__output, multiline=self.__multilineoutput, performancedata=self.__performancedata)