more logging

This commit is contained in:
Maxim Ermilov
2015-12-10 16:56:49 -05:00
parent 4ad7237f23
commit 7affe037f9
3 changed files with 16 additions and 3 deletions
@@ -111,6 +111,7 @@ class AlertController(NSObject):
def alertToExtraUpdates(self):
'''Notify user of additional pending updates'''
msclog.log("user", "extra_updates_pending")
alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_(
NSLocalizedString(
u"Additional Pending Updates",
@@ -200,6 +201,7 @@ class AlertController(NSObject):
def installSessionErrorAlert(self):
'''Something has gone wrong and we can't trigger an install at logout'''
msclog.log("user", "install_session_failed")
alertMessageText = NSLocalizedString(
u"Install session failed", u"Install Session Failed title")
detailText = NSLocalizedString(
@@ -399,4 +401,3 @@ class AlertController(NSObject):
if buttonPressed == NSAlertAlternateReturn:
return True
return False
@@ -222,6 +222,7 @@ class MSCMainWindowController(NSWindowController):
alertMessageText = NSLocalizedString(
u"Update check failed", u"Update Check Failed title")
if tasktype == "installwithnologout":
msclog.log("MSC", "cant_update", "Install session failed")
alertMessageText = NSLocalizedString(
u"Install session failed", u"Install Session Failed title")
@@ -751,6 +752,7 @@ class MSCMainWindowController(NSWindowController):
clicks the Install button in the Updates view'''
if self._update_in_progress:
# this is now a stop/cancel button
msclog.log('user', 'cancel_updates')
NSApp.delegate().statusController.disableStopButton()
NSApp.delegate().statusController._status_stopBtnState = 1
self.stop_requested = True
@@ -763,6 +765,7 @@ class MSCMainWindowController(NSWindowController):
elif self.getUpdateCount() == 0:
# no updates, this button must say "Check Again"
msclog.log('user', 'refresh_clicked')
self.checkForUpdates()
else:
# must say "Update"
@@ -872,6 +875,8 @@ class MSCMainWindowController(NSWindowController):
# there was a problem, can't continue
return
msclog.log('user', 'optional_install_' + item['status'], item_name)
# do we need to add a new node to the other list?
if item.get('needs_update'):
# make some new HTML for the updated item
@@ -1035,6 +1040,7 @@ class MSCMainWindowController(NSWindowController):
msclog.debug_log('Can\'t find item: %s' % item_name)
return
showAlert = True
if item['status'] == 'not-installed' and item.get('preinstall_alert'):
self.displayPreInstallUninstallAlert_Action_Item_(
item['preinstall_alert'],
@@ -1050,6 +1056,9 @@ class MSCMainWindowController(NSWindowController):
self.actionButtonPerformAction_, item_name)
else:
self.actionButtonPerformAction_(item_name)
showAlert = False
if showAlert:
msclog.log("user", "show_alert")
def displayPreInstallUninstallAlert_Action_Item_(
self, alert_dict, action_selector, item_name):
@@ -1093,9 +1102,9 @@ class MSCMainWindowController(NSWindowController):
'''Called when alert invoked by actionButtonClicked_ ends'''
alert.window().orderOut_(self)
if returncode == NSAlertDefaultReturn:
msclog.log("user", "alert canceled")
msclog.log("user", "alert_canceled")
else:
msclog.log("user", "alert accepted")
msclog.log("user", "alert_accepted")
selector = self.alert_context_info.get('selector')
item_name = self.alert_context_info.get('item_name')
if selector and item_name:
@@ -1116,6 +1125,7 @@ class MSCMainWindowController(NSWindowController):
if not self.update_status_for_item(item):
# there was a problem, can't continue
return
msclog.log('user', 'action_button_' + item['status'], item_name)
self.displayUpdateCount()
self.updateDOMforOptionalItem(item)
@@ -207,6 +207,7 @@ class MSCStatusController(NSObject):
def doRestartAlert(self):
'''Display a restart alert -- some item just installed or removed requires a restart'''
msclog.log("MSC", "restart_required")
self._status_restartAlertDismissed = 0
alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_(
NSLocalizedString(u"Restart Required", u"Restart Required title"),
@@ -224,6 +225,7 @@ class MSCStatusController(NSObject):
def restartAlertDidEnd_returnCode_contextInfo_(
self, alert, returncode, contextinfo):
'''Called when restartAlert ends'''
msclog.log("MSC", "restart_confirmed")
self._status_restartAlertDismissed = 1
munki.restartNow()