Beispiel #1
0
 def logoutAlertDidEnd_returnCode_contextInfo_(self, alert, returncode, contextinfo):
     if returncode == 0:
         NSLog("User cancelled")
         munki.log("user", "cancelled")
     elif returncode == 1:
         NSLog("User chose to log out")
         munki.log("user", "install_with_logout")
         result = munki.logoutAndUpdate()
         if result:
             self.installSessionErrorAlert()
     elif returncode == -1:
         # dismiss the alert sheet now because we might display
         # another alert
         alert.window().orderOut_(self)
         if self.alertIfBlockingAppsRunning():
             pass
         else:
             NSLog("User chose to update without logging out")
             munki.log("user", "install_without_logout")
             result = munki.justUpdate()
             if result:
                 self.installSessionErrorAlert()
             else:
                 self.managedsoftwareupdate_task = "installwithnologout"
                 self.mainWindowController.theWindow.orderOut_(self)
                 self.munkiStatusController.window.makeKeyAndOrderFront_(self)
                 self.munkiStatusController.startMunkiStatusSession()
Beispiel #2
0
 def logoutAlertDidEnd_returnCode_contextInfo_(
                                     self, alert, returncode, contextinfo):
     self._currentAlert = None
     if returncode == NSAlertDefaultReturn:
         if self.alertIfRunnningOnBattery():
             munki.log("user", "alerted_on_battery_power_and_cancelled")
             return
         NSLog("User chose to logout")
         munki.log("user", "install_with_logout")
         result = munki.logoutAndUpdate()
         if result:
             self.installSessionErrorAlert()
     elif returncode == NSAlertAlternateReturn:
         NSLog("User cancelled")
         munki.log("user", "cancelled")
     elif returncode == NSAlertOtherReturn:
         # dismiss the alert sheet now because we might display
         # another alert
         alert.window().orderOut_(self)
         if self.alertIfBlockingAppsRunning():
             return
         if self.alertIfRunnningOnBattery():
             munki.log("user", "alerted_on_battery_power_and_cancelled")
             return
         NSLog("User chose to update without logging out")
         munki.log("user", "install_without_logout")
         result = munki.justUpdate()
         if result:
             self.installSessionErrorAlert()
         else:
             self.managedsoftwareupdate_task = "installwithnologout"
             self.mainWindowController.theWindow.orderOut_(self)
             self.munkiStatusController.window.makeKeyAndOrderFront_(self)
             self.munkiStatusController.startMunkiStatusSession()
Beispiel #3
0
 def logoutAlertDidEnd_returnCode_contextInfo_(self, alert, returncode,
                                               contextinfo):
     self._currentAlert = None
     if returncode == NSAlertDefaultReturn:
         if self.alertIfRunnningOnBattery():
             munki.log("user", "alerted_on_battery_power_and_cancelled")
             return
         NSLog("User chose to logout")
         munki.log("user", "install_with_logout")
         result = munki.logoutAndUpdate()
         if result:
             self.installSessionErrorAlert()
     elif returncode == NSAlertAlternateReturn:
         NSLog("User cancelled")
         munki.log("user", "cancelled")
     elif returncode == NSAlertOtherReturn:
         # dismiss the alert sheet now because we might display
         # another alert
         alert.window().orderOut_(self)
         if self.alertIfBlockingAppsRunning():
             return
         if self.alertIfRunnningOnBattery():
             munki.log("user", "alerted_on_battery_power_and_cancelled")
             return
         NSLog("User chose to update without logging out")
         munki.log("user", "install_without_logout")
         result = munki.justUpdate()
         if result:
             self.installSessionErrorAlert()
         else:
             self.managedsoftwareupdate_task = "installwithnologout"
             self.mainWindowController.theWindow.orderOut_(self)
             self.munkiStatusController.window.makeKeyAndOrderFront_(self)
             self.munkiStatusController.startMunkiStatusSession()
 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()