/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-05-31 15:29:22 UTC
  • Revision ID: teddy@recompile.se-20150531152922-o1xv6qr3hbj1twm0
mandos: Use codecs.open() and print() for PID file.

Use more Pythonic code, closer to the Python 3 style.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
4
4
# Mandos Monitor - Control and monitor the Mandos server
5
5
6
 
# Copyright © 2009-2015 Teddy Hogeborn
7
 
# Copyright © 2009-2015 Björn Påhlsson
 
6
# Copyright © 2009-2014 Teddy Hogeborn
 
7
# Copyright © 2009-2014 Björn Påhlsson
8
8
9
9
# This program is free software: you can redistribute it and/or modify
10
10
# it under the terms of the GNU General Public License as published by
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))
 
193
                                os.WTERMSIG(condition)))
 
194
        elif os.WCOREDUMP(condition):
 
195
            self.logger('Checker for client {} (command "{}") dumped'
 
196
                        ' core'.format(self.properties["Name"],
 
197
                                       command))
194
198
        else:
195
199
            self.logger('Checker for client {} completed'
196
200
                        ' mysteriously'