[modules/dnf] quotes
This commit is contained in:
parent
940b577225
commit
9a6e044218
1 changed files with 16 additions and 16 deletions
|
@ -19,7 +19,7 @@ import bumblebee.engine
|
||||||
|
|
||||||
def get_dnf_info(widget):
|
def get_dnf_info(widget):
|
||||||
try:
|
try:
|
||||||
res = bumblebee.util.execute("dnf updateinfo")
|
res = bumblebee.util.execute('dnf updateinfo')
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -27,26 +27,26 @@ def get_dnf_info(widget):
|
||||||
bugfixes = 0
|
bugfixes = 0
|
||||||
enhancements = 0
|
enhancements = 0
|
||||||
other = 0
|
other = 0
|
||||||
for line in res.split("\n"):
|
for line in res.split('\n'):
|
||||||
|
|
||||||
if not line.startswith(" "): continue
|
if not line.startswith(' '): continue
|
||||||
elif "ecurity" in line:
|
elif 'ecurity' in line:
|
||||||
for s in line.split():
|
for s in line.split():
|
||||||
if s.isdigit(): security += int(s)
|
if s.isdigit(): security += int(s)
|
||||||
elif "ugfix" in line:
|
elif 'ugfix' in line:
|
||||||
for s in line.split():
|
for s in line.split():
|
||||||
if s.isdigit(): bugfixes += int(s)
|
if s.isdigit(): bugfixes += int(s)
|
||||||
elif "hancement" in line:
|
elif 'hancement' in line:
|
||||||
for s in line.split():
|
for s in line.split():
|
||||||
if s.isdigit(): enhancements += int(s)
|
if s.isdigit(): enhancements += int(s)
|
||||||
else:
|
else:
|
||||||
for s in line.split():
|
for s in line.split():
|
||||||
if s.isdigit(): other += int(s)
|
if s.isdigit(): other += int(s)
|
||||||
|
|
||||||
widget.set("security", security)
|
widget.set('security', security)
|
||||||
widget.set("bugfixes", bugfixes)
|
widget.set('bugfixes', bugfixes)
|
||||||
widget.set("enhancements", enhancements)
|
widget.set('enhancements', enhancements)
|
||||||
widget.set("other", other)
|
widget.set('other', other)
|
||||||
|
|
||||||
class Module(bumblebee.engine.Module):
|
class Module(bumblebee.engine.Module):
|
||||||
def __init__(self, engine, config):
|
def __init__(self, engine, config):
|
||||||
|
@ -57,9 +57,9 @@ class Module(bumblebee.engine.Module):
|
||||||
|
|
||||||
def updates(self, widget):
|
def updates(self, widget):
|
||||||
result = []
|
result = []
|
||||||
for t in ["security", "bugfixes", "enhancements", "other"]:
|
for t in ['security', 'bugfixes', 'enhancements', 'other']:
|
||||||
result.append(str(widget.get(t, 0)))
|
result.append(str(widget.get(t, 0)))
|
||||||
return "/".join(result)
|
return '/'.join(result)
|
||||||
|
|
||||||
def update(self, widgets):
|
def update(self, widgets):
|
||||||
thread = threading.Thread(target=get_dnf_info, args=(widgets[0],))
|
thread = threading.Thread(target=get_dnf_info, args=(widgets[0],))
|
||||||
|
@ -67,11 +67,11 @@ class Module(bumblebee.engine.Module):
|
||||||
|
|
||||||
def state(self, widget):
|
def state(self, widget):
|
||||||
cnt = 0
|
cnt = 0
|
||||||
for t in ["security", "bugfixes", "enhancements", "other"]:
|
for t in ['security', 'bugfixes', 'enhancements', 'other']:
|
||||||
cnt += widget.get(t, 0)
|
cnt += widget.get(t, 0)
|
||||||
if cnt == 0:
|
if cnt == 0:
|
||||||
return "good"
|
return 'good'
|
||||||
if cnt > 50 or widget.get("security", 0) > 0:
|
if cnt > 50 or widget.get('security', 0) > 0:
|
||||||
return "critical"
|
return 'critical'
|
||||||
|
|
||||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||||
|
|
Loading…
Reference in a new issue