mirror of
https://github.com/opinkerfi/nagios-plugins.git
synced 2024-11-22 02:13:44 +01:00
pycharm recomended formatting fixes
This commit is contained in:
parent
ec0cece507
commit
6a69093487
@ -20,12 +20,11 @@ from pynag.Plugins import PluginHelper, unknown, ok
|
||||
|
||||
known_types = ['Enhancement', 'Normal', 'Bug fix', 'Security']
|
||||
|
||||
|
||||
def main():
|
||||
p = PluginHelper()
|
||||
p.parse_arguments()
|
||||
p.status(ok)
|
||||
opt = p.options
|
||||
|
||||
|
||||
total_updates = 0
|
||||
pkg_updates = {}
|
||||
@ -49,6 +48,7 @@ def main():
|
||||
p.check_all_metrics()
|
||||
p.exit()
|
||||
|
||||
|
||||
def pkcon_get_updates():
|
||||
"""
|
||||
Fetches all package updates and returns a tuple containing:
|
||||
@ -68,7 +68,7 @@ def pkcon_get_updates():
|
||||
rc = p.wait() >> 8
|
||||
except OSError, e:
|
||||
if e.errno == 2:
|
||||
raise Exception("%s - PackageKit not installed?" % (e.strerror))
|
||||
raise Exception("%s - PackageKit not installed?" % e.strerror)
|
||||
|
||||
total_updates = 0
|
||||
results_section = False
|
||||
@ -87,14 +87,15 @@ def pkcon_get_updates():
|
||||
total_updates += 1
|
||||
|
||||
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:
|
||||
raise Exception("pkcon returned no 'Results:' section. Output of pkcon command:\n" + stdout)
|
||||
|
||||
for t in known_types:
|
||||
if t not in update_types:
|
||||
update_types[t] = []
|
||||
return (total_updates, update_types)
|
||||
return total_updates, update_types
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
Reference in New Issue
Block a user