/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-06-28 16:35:27 UTC
  • mto: This revision was merged to the branch mainline in revision 759.
  • Revision ID: teddy@recompile.se-20150628163527-cky0ec59zew7teua
Add a plugin helper directory, available to all plugins.

* Makefile (PLUGIN_HELPERS): New; list of plugin helpers.
  (CPROGS): Appended "$(PLUGIN_HELPERS)".
* initramfs-tools-hook: Create new plugin helper directory, and copy
                        plugin helpers provided by the system and/or
                        by the local administrator.
  (PLUGINHELPERDIR): New.
* plugin-runner.c: Take new --plugin-helper-dir option and provide
                   environment variable to all plugins.
  (PHDIR): New; set to "/lib/mandos/plugin-helpers".
  (main/pluginhelperdir): New.
  (main/options): New option "--plugin-helper-dir".
  (main/parse_opt, main/parse_opt_config_file): Accept new option.
  (main): Use new option to set MANDOSPLUGINHELPERDIR environment
          variable as if using --global-env MANDOSPLUGINHELPERDIR=...
* plugin-runner.xml: Document new --plugin-helper-dir option.
  (SYNOPSIS, OPTIONS): Add "--plugin-helper-dir" option.
  (PLUGINS/WRITING PLUGINS): Document new environment variable
                             available to plugins.
  (ENVIRONMENT): Document new environment variable
                 "MANDOSPLUGINHELPERDIR" affected by the new
                 --plugin-helper-dir option.

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'