Stub code for the case where Fast User Switching is active, we're switched to the loginwindow with one or more users logged in, and we need to restart.

git-svn-id: http://munki.googlecode.com/svn/trunk@443 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
Greg Neagle
2010-02-05 23:00:29 +00:00
parent c3b3dd8a04
commit 36e4d6e727

View File

@@ -143,10 +143,22 @@ def doRestart():
else:
print restartMessage
sys.stdout.flush()
if munkicommon.getconsoleuser() == None:
consoleuser = munkicommon.getconsoleuser()
if consoleuser == None:
# no-one is logged in and we're at the loginwindow
time.sleep(5)
retcode = subprocess.call(["/sbin/shutdown", "-r", "now"])
elif consoleuser == u"loginwindow":
# crap. Someone is logged in, Fast User Switching is active,
# but we're switched out to the loginwindow. Not safe to
# restart because users might have unsaved work.
# this could happen if someone switched to the loginwindow while
# updates were being installed.
#
# TO-DO: handle this!
#
pass
else:
if munkicommon.munkistatusoutput:
# someone is logged in and we're using munkistatus