def checkForUpdates(self): # kick off an update check # close main window self.mainWindowController.theWindow.orderOut_(self) # clear data structures self._listofupdates = [] self._optionalInstalls = [] self.update_view_controller.tableView.deselectAll_(self) self.update_view_controller.setUpdatelist_([]) self.optional_view_controller.tableView.deselectAll_(self) self.optional_view_controller.setOptionallist_([]) # attempt to start the update check result = munki.startUpdateCheck() if result == 0: self.managedsoftwareupdate_task = "manualcheck" self.munkiStatusController.window.makeKeyAndOrderFront_(self) self.munkiStatusController.startMunkiStatusSession() else: self.mainWindowController.theWindow.makeKeyAndOrderFront_(self) alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_( NSLocalizedString(u"Update check failed", None), NSLocalizedString(u"Quit", None), objc.nil, objc.nil, NSLocalizedString(u"There is a configuration problem with the managed software installer. Could not start the update check process. Contact your systems administrator.", None)) alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_( self.mainWindowController.theWindow, self, self.quitAlertDidEnd_returnCode_contextInfo_, objc.nil)
def checkForUpdates(self): # kick off an update check # close main window self.mainWindowController.theWindow.orderOut_(self) # clear data structures self._listofupdates = [] self._optionalInstalls = [] self.update_view_controller.tableView.deselectAll_(self) self.update_view_controller.setUpdatelist_([]) self.optional_view_controller.tableView.deselectAll_(self) self.optional_view_controller.setOptionallist_([]) # attempt to start the update check result = munki.startUpdateCheck() if result == 0: self.managedsoftwareupdate_task = "manualcheck" self.munkiStatusController.window.makeKeyAndOrderFront_(self) self.munkiStatusController.startMunkiStatusSession() else: self.mainWindowController.theWindow.makeKeyAndOrderFront_(self) alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_( NSLocalizedString(u"Update check failed", None), NSLocalizedString(u"Quit", None), objc.nil, objc.nil, NSLocalizedString( u"There is a configuration problem with the managed software installer. Could not start the update check process. Contact your systems administrator.", None)) alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_( self.mainWindowController.theWindow, self, self.quitAlertDidEnd_returnCode_contextInfo_, objc.nil)
def checkForUpdates(self, suppress_apple_update_check=False): '''start an update check session''' # attempt to start the update check if self._update_in_progress: return result = munki.startUpdateCheck(suppress_apple_update_check) if result == 0: self._update_in_progress = True self.displayUpdateCount() self.managedsoftwareupdate_task = "manualcheck" NSApp.delegate().statusController.startMunkiStatusSession() self.markRequestedItemsAsProcessing() else: self.munkiStatusSessionEnded_(2)
def updateNow(self): '''If user has added to/removed from the list of things to be updated, run a check session. If there are no more changes, proceed to an update installation session if items to be installed/removed are exclusively those selected by the user in this session''' if self.stop_requested: # reset the flag self.stop_requested = False self.resetAndReload() return if MunkiItems.updateCheckNeeded(): # any item status changes that require an update check? msclog.debug_log('updateCheck needed') msclog.log("user", "check_then_install_without_logout") # since we are just checking for changed self-service items # we can suppress the Apple update check suppress_apple_update_check = True self._update_in_progress = True self.displayUpdateCount() result = munki.startUpdateCheck(suppress_apple_update_check) if result: msclog.debug_log("Error starting check-then-install session: %s" % result) self.munkiStatusSessionEnded_(2) else: self.managedsoftwareupdate_task = "checktheninstall" NSApp.delegate().statusController.startMunkiStatusSession() self.markRequestedItemsAsProcessing() elif (not self._alertedUserToOutstandingUpdates and MunkiItems.updatesContainNonUserSelectedItems()): # current list of updates contains some not explicitly chosen by the user msclog.debug_log('updateCheck not needed, items require user approval') self._update_in_progress = False self.displayUpdateCount() self.loadUpdatesPage_(self) self.alert_controller.alertToExtraUpdates() else: msclog.debug_log('updateCheck not needed') self._alertedUserToOutstandingUpdates = False self.kickOffInstallSession()