3333RC_OKAY = int (os .environ ["RC_OKAY" ])
3434RC_FAILED = int (os .environ ["RC_FAILED" ])
3535RC_SKIPPED = int (os .environ ["RC_SKIPPED" ])
36+ RC_INFO = int (os .environ ["RC_INFO" ])
3637exitCode = RC_OKAY
3738errorMsg = ""
3839rebootList = ""
@@ -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"
0 commit comments