add OS logic

This commit is contained in:
Mike Reeves
2023-06-28 15:57:43 -04:00
parent 03342fd477
commit fee4c20912
5 changed files with 78 additions and 1 deletions

View File

@@ -10,6 +10,14 @@ def check():
if path.exists('/var/run/reboot-required'):
retval = 'True'
elif os == 'CentOS Stream':
cmd = 'needs-restarting -r > /dev/null 2>&1'
try:
needs_restarting = subprocess.check_call(cmd, shell=True)
except subprocess.CalledProcessError:
retval = 'True'
elif os == 'Rocky':
cmd = 'needs-restarting -r > /dev/null 2>&1'