1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-22 10:23:46 +01:00

pycharm recomended formatting fixes

This commit is contained in:
Tomas Edwardsson 2013-07-16 10:27:04 +00:00
parent ec0cece507
commit 6a69093487

View File

@ -20,12 +20,11 @@ from pynag.Plugins import PluginHelper, unknown, ok
known_types = ['Enhancement', 'Normal', 'Bug fix', 'Security'] known_types = ['Enhancement', 'Normal', 'Bug fix', 'Security']
def main(): def main():
p = PluginHelper() p = PluginHelper()
p.parse_arguments() p.parse_arguments()
p.status(ok) p.status(ok)
opt = p.options
total_updates = 0 total_updates = 0
pkg_updates = {} pkg_updates = {}
@ -49,6 +48,7 @@ def main():
p.check_all_metrics() p.check_all_metrics()
p.exit() p.exit()
def pkcon_get_updates(): def pkcon_get_updates():
""" """
Fetches all package updates and returns a tuple containing: Fetches all package updates and returns a tuple containing:
@ -68,7 +68,7 @@ def pkcon_get_updates():
rc = p.wait() >> 8 rc = p.wait() >> 8
except OSError, e: except OSError, e:
if e.errno == 2: if e.errno == 2:
raise Exception("%s - PackageKit not installed?" % (e.strerror)) raise Exception("%s - PackageKit not installed?" % e.strerror)
total_updates = 0 total_updates = 0
results_section = False results_section = False
@ -87,14 +87,15 @@ def pkcon_get_updates():
total_updates += 1 total_updates += 1
if rc > 0: if rc > 0:
raise Exception("pkcon returned non zero return code %i, output:\n%s\nstderr output:\n%s" % (rc, stdout, stderr)) raise Exception(
"pkcon returned non zero return code %i, output:\n%s\nstderr output:\n%s" % (rc, stdout, stderr))
if results_section is False: if results_section is False:
raise Exception("pkcon returned no 'Results:' section. Output of pkcon command:\n" + stdout) raise Exception("pkcon returned no 'Results:' section. Output of pkcon command:\n" + stdout)
for t in known_types: for t in known_types:
if t not in update_types: if t not in update_types:
update_types[t] = [] update_types[t] = []
return (total_updates, update_types) return total_updates, update_types
if __name__ == "__main__": if __name__ == "__main__":