Update needs_restarting.py

This commit is contained in:
Mike Reeves
2023-07-20 08:25:13 -04:00
committed by GitHub
parent 066de70638
commit 54082858dc

View File

@@ -3,22 +3,14 @@ import subprocess
def check(): def check():
os = __grains__['os'] osfam = __grains__['os_family']
retval = 'False' retval = 'False'
if os == 'Ubuntu': if osfam == 'Ubuntu':
if path.exists('/var/run/reboot-required'): if path.exists('/var/run/reboot-required'):
retval = 'True' retval = 'True'
elif os == 'CentOS Stream': elif
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' cmd = 'needs-restarting -r > /dev/null 2>&1'
try: try: