Example #1
0
 def checkProcess_(self, timer):
     '''Monitors managedsoftwareupdate process for failure to start
     or unexpected exit, so we're not waiting around forever if
     managedsoftwareupdate isn't running.'''
     PYTHON_SCRIPT_NAME = u'managedsoftwareupdate'
     NEVER_STARTED = -2
     UNEXPECTEDLY_QUIT = -1
     
     if self.session_started:
         if self.got_status_update:
             # we got a status update since we last checked; no need to
             # check the process table
             self.timeout_counter = 6
             self.saw_process = True
             # clear the flag so we have to get another status update
             self.got_status_update = False
         elif munki.pythonScriptRunning(PYTHON_SCRIPT_NAME):
             self.timeout_counter = 6
             self.saw_process = True
         else:
             msclog.debug_log('managedsoftwareupdate not running...')
             self.timeout_counter -= 1
         if self.timeout_counter == 0:
             msclog.debug_log('Timed out waiting for managedsoftwareupdate.')
             if self.saw_process:
                 self.sessionEnded_(UNEXPECTEDLY_QUIT)
             else:
                 self.sessionEnded_(NEVER_STARTED)
Example #2
0
    def checkProcess_(self, timer):
        '''Monitors managedsoftwareupdate process for failure to start
        or unexpected exit, so we're not waiting around forever if
        managedsoftwareupdate isn't running.'''
        PYTHON_SCRIPT_NAME = u'managedsoftwareupdate'
        NEVER_STARTED = -2
        UNEXPECTEDLY_QUIT = -1

        if self.session_started:
            if self.got_status_update:
                # we got a status update since we last checked; no need to
                # check the process table
                self.timeout_counter = 6
                self.saw_process = True
                # clear the flag so we have to get another status update
                self.got_status_update = False
            elif munki.pythonScriptRunning(PYTHON_SCRIPT_NAME):
                self.timeout_counter = 6
                self.saw_process = True
            else:
                msclog.debug_log('managedsoftwareupdate not running...')
                self.timeout_counter -= 1
            if self.timeout_counter == 0:
                msclog.debug_log(
                    'Timed out waiting for managedsoftwareupdate.')
                if self.saw_process:
                    self.sessionEnded_(UNEXPECTEDLY_QUIT)
                else:
                    self.sessionEnded_(NEVER_STARTED)
    def checkProcess(self):
        '''Monitors managedsoftwareupdate process for failure to start
        or unexpected exit, so we're not waiting around forever if
        managedsoftwareupdate isn't running.'''
        PYTHON_SCRIPT_NAME = 'managedsoftwareupdate'
        NEVER_STARTED = -2
        UNEXPECTEDLY_QUIT = -1

        NSLog('checkProcess timer fired')

        if self.window_level == NSScreenSaverWindowLevel:
            # we're at the loginwindow, there is a PolicyBanner, and we're
            # running under 10.11+. Make sure we're in the front.
            NSApp.activateIgnoringOtherApps_(YES)
            if not self.logWindow.isVisible():
                self.window.makeKeyAndOrderFront_(self)

        if self.got_status_update:
            # we got a status update since we last checked; no need to
            # check the process table
            self.timeout_counter = 6
            self.saw_process = True
            # clear the flag so we have to get another status update
            self.got_status_update = False
        elif munki.pythonScriptRunning(PYTHON_SCRIPT_NAME):
            self.timeout_counter = 6
            self.saw_process = True
        else:
            NSLog('managedsoftwareupdate not running...')
            self.timeout_counter -= 1
        if self.timeout_counter == 0:
            NSLog('Timed out waiting for managedsoftwareupdate.')
            if self.saw_process:
                self.statusSessionFailed_(UNEXPECTEDLY_QUIT)
            else:
                self.statusSessionFailed_(NEVER_STARTED)
    def checkProcess(self):
        '''Monitors managedsoftwareupdate process for failure to start
        or unexpected exit, so we're not waiting around forever if
        managedsoftwareupdate isn't running.'''
        PYTHON_SCRIPT_NAME = 'managedsoftwareupdate'
        NEVER_STARTED = -2
        UNEXPECTEDLY_QUIT = -1

        NSLog('checkProcess timer fired')

        if self.window_level == NSScreenSaverWindowLevel:
            # we're at the loginwindow, there is a PolicyBanner, and we're
            # running under 10.11+. Make sure we're in the front.
            NSApp.activateIgnoringOtherApps_(YES)
            if not self.logWindow.isVisible():
                self.window.makeKeyAndOrderFront_(self)

        if self.got_status_update:
            # we got a status update since we last checked; no need to
            # check the process table
            self.timeout_counter = 6
            self.saw_process = True
            # clear the flag so we have to get another status update
            self.got_status_update = False
        elif munki.pythonScriptRunning(PYTHON_SCRIPT_NAME):
            self.timeout_counter = 6
            self.saw_process = True
        else:
            NSLog('managedsoftwareupdate not running...')
            self.timeout_counter -= 1
        if self.timeout_counter == 0:
            NSLog('Timed out waiting for managedsoftwareupdate.')
            if self.saw_process:
                self.statusSessionFailed_(UNEXPECTEDLY_QUIT)
            else:
                self.statusSessionFailed_(NEVER_STARTED)