/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: 2015-08-10 07:34:37 UTC
  • Revision ID: teddy@recompile.se-20150810073437-3m8jgt13nqric6vf
Revert change to D-Bus API.

The D-Bus API signal CheckerCompleted is documented to provide a
wait(2) status value.  Since the server switched to using subprocess
to run checkers, it no longer has access to a wait(2) status value.  A
previous change to work around this made the D-Bus API incompatible.
Revert this change by constructing a fake wait(2) status value; this
keeps the D-Bus API stable.

* DBUS-API (CheckerCompleted): Revert incompatible change.
* mandos (ClientDBus.checker_callback): Construct fake wait(2) status.
* mandos-monitor (MandosClientWidget.checker_completed): Revert to
                                                         using
                                                         original API
                                                         with wait(2)
                                                         condition
                                                         value.

Show diffs side-by-side

added added

removed removed

Lines of Context:
173
173
            gobject.source_remove(self._update_timer_callback_tag)
174
174
            self._update_timer_callback_tag = None
175
175
    
176
 
    def checker_completed(self, exitstatus, signal, command):
 
176
    def checker_completed(self, exitstatus, condition, command):
177
177
        if exitstatus == 0:
178
178
            self.logger('Checker for client {} (command "{}")'
179
179
                        ' succeeded'.format(self.properties["Name"],
181
181
            self.update()
182
182
            return
183
183
        # Checker failed
184
 
        if exitstatus >= 0:
 
184
        if os.WIFEXITED(condition):
185
185
            self.logger('Checker for client {} (command "{}") failed'
186
186
                        ' with exit code {}'
187
187
                        .format(self.properties["Name"], command,
188
 
                                exitstatus))
189
 
        elif signal != 0:
 
188
                                os.WEXITSTATUS(condition)))
 
189
        elif os.WIFSIGNALED(condition):
190
190
            self.logger('Checker for client {} (command "{}") was'
191
191
                        ' killed by signal {}'
192
192
                        .format(self.properties["Name"], command,
193
 
                                signal))
194
 
        else:
195
 
            self.logger('Checker for client {} completed'
196
 
                        ' mysteriously'
197
 
                        .format(self.properties["Name"]))
 
193
                                os.WTERMSIG(condition)))
198
194
        self.update()
199
195
    
200
196
    def checker_started(self, command):