/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos-monitor

  • Committer: Teddy Hogeborn
  • Date: 2012-01-15 21:02:37 UTC
  • mfrom: (558 trunk)
  • mto: (237.4.29 release)
  • mto: This revision was merged to the branch mainline in revision 559.
  • Revision ID: teddy@recompile.se-20120115210237-6mcl2zuoxyn5smr5
MergeĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
131
131
        
132
132
        self._update_timer_callback_tag = None
133
133
        self._update_timer_callback_lock = 0
134
 
        self.last_checker_failed = False
135
134
        
136
135
        # The widget shown normally
137
136
        self._text_widget = urwid.Text("")
145
144
        
146
145
        last_checked_ok = isoformat_to_datetime(self.properties
147
146
                                                ["LastCheckedOK"])
148
 
        if last_checked_ok is None:
149
 
            self.last_checker_failed = True
150
 
        else:
151
 
            self.last_checker_failed = ((datetime.datetime.utcnow()
152
 
                                         - last_checked_ok)
153
 
                                        > datetime.timedelta
154
 
                                        (milliseconds=
155
 
                                         self.properties
156
 
                                         ["Interval"]))
157
147
        
158
 
        if self.last_checker_failed:
 
148
        if self.properties ["LastCheckerStatus"] != 0:
159
149
            self.using_timer(True)
160
150
        
161
151
        if self.need_approval:
189
179
                                                         value)
190
180
        if property == "ApprovalPending":
191
181
            using_timer(bool(value))
192
 
        
 
182
        if property == "LastCheckerStatus":
 
183
            using_timer(value != 0)
 
184
            #self.logger('Checker for client %s (command "%s")'
 
185
            #            ' was successful'
 
186
            #            % (self.properties["Name"], command))
 
187
    
193
188
    def using_timer(self, flag):
194
189
        """Call this method with True or False when timer should be
195
190
        activated or deactivated.
210
205
    
211
206
    def checker_completed(self, exitstatus, condition, command):
212
207
        if exitstatus == 0:
213
 
            if self.last_checker_failed:
214
 
                self.last_checker_failed = False
215
 
                self.using_timer(False)
216
 
            #self.logger('Checker for client %s (command "%s")'
217
 
            #            ' was successful'
218
 
            #            % (self.properties["Name"], command))
219
208
            self.update()
220
209
            return
221
210
        # Checker failed
222
 
        if not self.last_checker_failed:
223
 
            self.last_checker_failed = True
224
 
            self.using_timer(True)
225
211
        if os.WIFEXITED(condition):
226
212
            self.logger('Checker for client %s (command "%s")'
227
213
                        ' failed with exit code %s'
249
235
        pass
250
236
    
251
237
    def got_secret(self):
252
 
        self.last_checker_failed = False
253
238
        self.logger('Client %s received its secret'
254
239
                    % self.properties["Name"])
255
240
    
316
301
            else:
317
302
                message = "Denial in %s. (a)pprove?"
318
303
            message = message % unicode(timer).rsplit(".", 1)[0]
319
 
        elif self.last_checker_failed:
 
304
        elif self.properties["LastCheckerStatus"] != 0:
320
305
            # When checker has failed, print a timer until client expires
321
306
            expires = self.properties["Expires"]
322
307
            if expires == "":