def confirmUpdatesAndInstall(self): '''Make sure it's OK to proceed with installing if logout or restart is required''' if self.alertedToMultipleUsers(): return elif MunkiItems.updatesRequireRestart(): alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_( NSLocalizedString(u"Restart Required", u"Restart Required title"), NSLocalizedString(u"Log out and update", u"Log out and Update button text"), NSLocalizedString(u"Cancel", u"Cancel button title/short action text"), nil, u"%@", NSLocalizedString( (u"A restart is required after updating. Please be patient " "as there may be a short delay at the login window. Log " "out and update now?"), u"Restart Required detail")) alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_( self.window, self, self.logoutAlertDidEnd_returnCode_contextInfo_, nil) elif MunkiItems.updatesRequireLogout() or munki.installRequiresLogout(): alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_( NSLocalizedString(u"Logout Required", u"Logout Required title"), NSLocalizedString(u"Log out and update", u"Log out and Update button text"), NSLocalizedString(u"Cancel", u"Cancel button title/short action text"), nil, u"%@", NSLocalizedString( (u"A logout is required before updating. Please be patient " "as there may be a short delay at the login window. Log " "out and update now?"), u"Logout Required detail")) alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_( self.window, self, self.logoutAlertDidEnd_returnCode_contextInfo_, nil) else: # we shouldn't have been invoked if neither a restart or logout was required msclog.debug_log( 'confirmUpdatesAndInstall was called but no restart or logout was needed')
def kickOffInstallSession(self): '''start an update install/removal session''' # check for need to logout, restart, firmware warnings # warn about blocking applications, etc... # then start an update session if MunkiItems.updatesRequireRestart() or MunkiItems.updatesRequireLogout(): # switch to updates view self.loadUpdatesPage_(self) # warn about need to logout or restart self.alert_controller.confirmUpdatesAndInstall() else: if self.alert_controller.alertedToBlockingAppsRunning(): self.loadUpdatesPage_(self) return if self.alert_controller.alertedToRunningOnBatteryAndCancelled(): self.loadUpdatesPage_(self) return self.managedsoftwareupdate_task = None msclog.log("user", "install_without_logout") self._update_in_progress = True self.displayUpdateCount() self.setStatusViewTitle_(NSLocalizedString(u"Updating...", u"Updating message")) result = munki.justUpdate() if result: msclog.debug_log("Error starting install session: %s" % result) self.munkiStatusSessionEnded_(2) else: self.managedsoftwareupdate_task = "installwithnologout" NSApp.delegate().statusController.startMunkiStatusSession() self.markPendingItemsAsInstalling()
def handlePossibleAuthRestart(self): '''Ask for and store a password for auth restart if needed/possible''' username = NSUserName() if (MunkiItems.updatesRequireRestart() and authrestart.verify_user(username) and not authrestart.verify_recovery_key_present()): # FV is on and user is in list of FV users, so they can # authrestart, and we do not have a stored FV recovery # key/password. So we should prompt the user for a password # we can use for fdesetup authrestart NSApp.delegate( ).passwordAlertController.promptForPasswordForAuthRestart()
def confirmUpdatesAndInstall(self): '''Make sure it's OK to proceed with installing if logout or restart is required''' if self.alertedToMultipleUsers(): return elif MunkiItems.updatesRequireRestart(): alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_( NSLocalizedString(u"Restart Required", u"Restart Required title"), NSLocalizedString(u"Log out and update", u"Log out and Update button text"), NSLocalizedString(u"Cancel", u"Cancel button title/short action text"), nil, u"%@", NSLocalizedString( u"A restart is required after updating. Please be patient " "as there may be a short delay at the login window. Log " "out and update now?", u"Restart Required detail")) alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_( self.window, self, self.logoutAlertDidEnd_returnCode_contextInfo_, nil) elif MunkiItems.updatesRequireLogout() or munki.installRequiresLogout( ): alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_( NSLocalizedString(u"Logout Required", u"Logout Required title"), NSLocalizedString(u"Log out and update", u"Log out and Update button text"), NSLocalizedString(u"Cancel", u"Cancel button title/short action text"), nil, u"%@", NSLocalizedString( u"A logout is required before updating. Please be patient " "as there may be a short delay at the login window. Log " "out and update now?", u"Logout Required detail")) alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_( self.window, self, self.logoutAlertDidEnd_returnCode_contextInfo_, nil) else: # we shouldn't have been invoked if neither a restart or logout was # required msclog.debug_log( 'confirmUpdatesAndInstall was called but no restart or logout ' 'was needed')