diff --git a/salt/_modules/needs_restarting.py b/salt/_modules/needs_restarting.py index 51f80670a..49f82bbf2 100644 --- a/salt/_modules/needs_restarting.py +++ b/salt/_modules/needs_restarting.py @@ -4,7 +4,6 @@ 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'): @@ -13,6 +12,7 @@ def check(): retval = 'False' elif os == 'CentOS': + cmd = 'needs-restarting -r > /dev/null 2>&1' try: needs_restarting = subprocess.check_call(cmd.split(), shell=True) except subprocess.CalledProcessError: