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