mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-07 01:32:47 +01:00
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:
25
salt/_modules/needs_restarting.py
Normal file
25
salt/_modules/needs_restarting.py
Normal 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
|
||||
Reference in New Issue
Block a user