update all nodes motd with nodes that need restarted from patch updates - https://github.com/Security-Onion-Solutions/securityonion-saltstack/issues/112

This commit is contained in:
m0duspwnens
2019-11-15 13:58:32 -05:00
parent b2b75acedb
commit ff4077a46f
6 changed files with 67 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
from os import path
import subprocess
def check():
os = __grains__['os']
cmd = 'needs-restarting -r > /dev/null 2>&1'
if os == 'Ubuntu':
if path.exists('/var/run/reboot-required'):
retval = 'True'
else:
retval = 'False'
elif os == 'CentOS':
try:
needs_restarting = subprocess.check_call(cmd.split(), shell=True)
except subprocess.CalledProcessError:
retval = 'True'
retval = 'False'
else:
retval = 'Unsupported OS: %s' % os
return retval