Skip to content

Commit 67f7501

Browse files
committed
Fix flake8
1 parent 513e93d commit 67f7501

3 files changed

Lines changed: 9 additions & 17 deletions

File tree

risuclient/plugins/core/system/reboot.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
RC_OKAY = int(os.environ["RC_OKAY"])
3434
RC_FAILED = int(os.environ["RC_FAILED"])
3535
RC_SKIPPED = int(os.environ["RC_SKIPPED"])
36+
RC_INFO = int(os.environ["RC_INFO"])
3637
exitCode = RC_OKAY
3738
errorMsg = ""
3839
rebootList = ""
@@ -192,15 +193,9 @@ def main():
192193
"""
193194

194195
global lastcontext
195-
global events
196-
global now
197-
global root_path
198196
global exitCode
199197
global errorMsg
200198
global rebootList
201-
global RC_OKAY
202-
global RC_FAILED
203-
global RC_SKIPPED
204199

205200
for filename in [
206201
os.path.join(root_path, "etc/redhat-release"),
@@ -213,9 +208,14 @@ def main():
213208

214209
if not os.path.isfile(os.path.join(root_path, "etc/redhat-release")):
215210
exitrisu(code=RC_SKIPPED, msg="Non Red Hat system, skipping")
211+
212+
release = open(os.path.join(root_path, "etc/redhat-release"), "r").read()
216213
if (
217-
"Red Hat Enterprise Linux Server release 7"
218-
not in open(os.path.join(root_path, "etc/redhat-release"), "r").read()
214+
not ("Red Hat Enterprise" in release and "7" in release)
215+
and not ("Red Hat Enterprise" in release and "8" in release)
216+
and not ("CentOS" in release and "7" in release)
217+
and not ("CentOS" in release and "8" in release)
218+
and ("Fedora release" not in release)
219219
):
220220
exitrisu(
221221
code=RC_SKIPPED,
@@ -293,7 +293,7 @@ def main():
293293

294294
if e.context == "os" and e.desc == "stop":
295295
# sets a clean reboot if the system was stopped in the previous 5 minutes
296-
if ne.desc == "start" and ne is not None:
296+
if ne is not None and ne.desc == "start":
297297
duration = (ne.time - e.time).total_seconds()
298298
if duration < 300:
299299
ne.status = "clean"

risuclient/plugins/metadata/events/reboots.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,8 @@ def main():
194194
"""
195195

196196
global lastcontext
197-
global events
198-
global now
199-
global root_path
200197
global exitCode
201-
global errorMsg
202198
global rebootList
203-
global RC_OKAY
204-
global RC_FAILED
205-
global RC_SKIPPED
206199

207200
for filename in [
208201
os.path.join(root_path, "etc/redhat-release"),

risuclient/shell.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,6 @@ def runplugin(plugin):
537537

538538
found = 0
539539

540-
global progress
541540
step = progress
542541

543542
# Loop tru extensions to find which one should handle it and run it

0 commit comments

Comments
 (0)