=== modified file 'mandos-monitor' --- mandos-monitor 2012-01-08 10:19:33 +0000 +++ mandos-monitor 2012-01-15 20:55:50 +0000 @@ -131,7 +131,6 @@ self._update_timer_callback_tag = None self._update_timer_callback_lock = 0 - self.last_checker_failed = False # The widget shown normally self._text_widget = urwid.Text("") @@ -145,17 +144,8 @@ last_checked_ok = isoformat_to_datetime(self.properties ["LastCheckedOK"]) - if last_checked_ok is None: - self.last_checker_failed = True - else: - self.last_checker_failed = ((datetime.datetime.utcnow() - - last_checked_ok) - > datetime.timedelta - (milliseconds= - self.properties - ["Interval"])) - if self.last_checker_failed: + if self.properties ["LastCheckerStatus"] != 0: self.using_timer(True) if self.need_approval: @@ -189,7 +179,12 @@ value) if property == "ApprovalPending": using_timer(bool(value)) - + if property == "LastCheckerStatus": + using_timer(value != 0) + #self.logger('Checker for client %s (command "%s")' + # ' was successful' + # % (self.properties["Name"], command)) + def using_timer(self, flag): """Call this method with True or False when timer should be activated or deactivated. @@ -210,18 +205,9 @@ def checker_completed(self, exitstatus, condition, command): if exitstatus == 0: - if self.last_checker_failed: - self.last_checker_failed = False - self.using_timer(False) - #self.logger('Checker for client %s (command "%s")' - # ' was successful' - # % (self.properties["Name"], command)) self.update() return # Checker failed - if not self.last_checker_failed: - self.last_checker_failed = True - self.using_timer(True) if os.WIFEXITED(condition): self.logger('Checker for client %s (command "%s")' ' failed with exit code %s' @@ -249,7 +235,6 @@ pass def got_secret(self): - self.last_checker_failed = False self.logger('Client %s received its secret' % self.properties["Name"]) @@ -316,7 +301,7 @@ else: message = "Denial in %s. (a)pprove?" message = message % unicode(timer).rsplit(".", 1)[0] - elif self.last_checker_failed: + elif self.properties["LastCheckerStatus"] != 0: # When checker has failed, print a timer until client expires expires = self.properties["Expires"] if expires == "":