本文整理汇总了Python中MunkiItems.updatesRequireRestart方法的典型用法代码示例。如果您正苦于以下问题:Python MunkiItems.updatesRequireRestart方法的具体用法?Python MunkiItems.updatesRequireRestart怎么用?Python MunkiItems.updatesRequireRestart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MunkiItems
的用法示例。
在下文中一共展示了MunkiItems.updatesRequireRestart方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: confirmUpdatesAndInstall
# 需要导入模块: import MunkiItems [as 别名]
# 或者: from MunkiItems import updatesRequireRestart [as 别名]
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')
示例2: kickOffInstallSession
# 需要导入模块: import MunkiItems [as 别名]
# 或者: from MunkiItems import updatesRequireRestart [as 别名]
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()
示例3: handlePossibleAuthRestart
# 需要导入模块: import MunkiItems [as 别名]
# 或者: from MunkiItems import updatesRequireRestart [as 别名]
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()