mirror of
https://github.com/munki/munki.git
synced 2026-04-24 05:49:42 -05:00
Run forced/unattended updates before checking if the user should be notified; notify them afterwards if any remaining attended installs remain.
1) disable status output (GUI) 2) run unattended installs 3) reenable status output (GUI) 4) notify user or remaining installs (if LastModifiedDate is happy) Also, change logging a little to make it easier to see difference between regular install run and unattended run. git-svn-id: http://munki.googlecode.com/svn/branches/unattended-installs@812 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
@@ -624,12 +624,13 @@ def main():
|
||||
# so do nothing
|
||||
pass
|
||||
elif not munkicommon.pref('SuppressUserNotification'):
|
||||
# notify the current console user
|
||||
user_was_notified = notifyUserOfUpdates()
|
||||
# if the user was not notified, do unattended installs.
|
||||
if not user_was_notified:
|
||||
munkicommon.munkistatusoutput = False
|
||||
doInstallTasks(only_unattended=True)
|
||||
# Disable status output and run unattended installs.
|
||||
munkicommon.munkistatusoutput = False
|
||||
doInstallTasks(only_unattended=True)
|
||||
# Reenable status output and notify user of any remaining
|
||||
# updates.
|
||||
munkicommon.munkistatusoutput = True
|
||||
notifyUserOfUpdates()
|
||||
else:
|
||||
munkicommon.log('Skipping user notification because '
|
||||
'SuppressUserNotification is true.')
|
||||
|
||||
@@ -817,7 +817,11 @@ def run(only_unattended=False):
|
||||
installdir = os.path.join(managedinstallbase , 'Cache')
|
||||
|
||||
removals_need_restart = installs_need_restart = False
|
||||
munkicommon.log("### Beginning managed installer session ###")
|
||||
|
||||
if only_unattended:
|
||||
munkicommon.log("### Beginning unattended installer session ###")
|
||||
else:
|
||||
munkicommon.log("### Beginning managed installer session ###")
|
||||
|
||||
installinfo = os.path.join(managedinstallbase, 'InstallInfo.plist')
|
||||
if os.path.exists(installinfo):
|
||||
@@ -827,14 +831,16 @@ def run(only_unattended=False):
|
||||
print >> sys.stderr, "Invalid %s" % installinfo
|
||||
return -1
|
||||
|
||||
if not only_unattended:
|
||||
# remove the install info file
|
||||
# it's no longer valid once we start running
|
||||
try:
|
||||
os.unlink(installinfo)
|
||||
except (OSError, IOError):
|
||||
munkicommon.display_warning(
|
||||
"Could not remove %s" % installinfo)
|
||||
# TODO(ogle): if unattended, remove installed items from
|
||||
# InstallInfo.plist but preserve the rest. Only rm if not unattended.
|
||||
|
||||
# remove the install info file
|
||||
# it's no longer valid once we start running
|
||||
try:
|
||||
os.unlink(installinfo)
|
||||
except (OSError, IOError):
|
||||
munkicommon.display_warning(
|
||||
"Could not remove %s" % installinfo)
|
||||
|
||||
if (munkicommon.munkistatusoutput and
|
||||
munkicommon.pref('SuppressStopButtonOnInstall')):
|
||||
@@ -888,10 +894,14 @@ def run(only_unattended=False):
|
||||
installlist)
|
||||
|
||||
else:
|
||||
if not only_unattended:
|
||||
if not only_unattended: # not need to log that no unattended found.
|
||||
munkicommon.log("No %s found." % installinfo)
|
||||
|
||||
munkicommon.log("### End managed installer session ###")
|
||||
if only_unattended:
|
||||
munkicommon.log("### End unattended installer session ###")
|
||||
else:
|
||||
munkicommon.log("### End managed installer session ###")
|
||||
|
||||
munkicommon.savereport()
|
||||
|
||||
return (removals_need_restart or installs_need_restart)
|
||||
|
||||
Reference in New Issue
Block a user