[jhbuild] add option to reload config of buildbot server (#575626)



commit b21a5d626f163b413cc7fcd74770dd381f1b77a9
Author: Frederic Peters <fpeters 0d be>
Date:   Tue Apr 21 22:40:41 2009 +0200

    add option to reload config of buildbot server (#575626)
    
    Use it like this: jhbuild bot --reload-server-config --pidfile=...
---
 jhbuild/commands/bot.py |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/jhbuild/commands/bot.py b/jhbuild/commands/bot.py
index 5cc9e70..9fd9e4f 100644
--- a/jhbuild/commands/bot.py
+++ b/jhbuild/commands/bot.py
@@ -69,6 +69,9 @@ class cmd_bot(Command):
             make_option('--start-server',
                         action='store_true', dest='start_server', default=False,
                         help=_('start a buildbot master server')),
+            make_option('--reload-server-config',
+                        action='store_true', dest='reload_server_config', default=False,
+                        help=_('reload a buildbot master server configuration')),
             make_option('--stop-server',
                         action='store_true', dest='stop_server', default=False,
                         help=_('stop a buildbot master server')),
@@ -169,6 +172,9 @@ class cmd_bot(Command):
         if options.stop or options.stop_server:
             return self.stop(config, pidfile)
 
+        if options.reload_server_config:
+            return self.reload_server_config(config, pidfile)
+
     def setup(self, config):
         module_set = jhbuild.moduleset.load(config, 'buildbot')
         module_list = module_set.get_module_list('all', config.skip)
@@ -665,6 +671,14 @@ class cmd_bot(Command):
 
         os.kill(pid, signal.SIGTERM)
 
+    def reload_server_config(self, config, pidfile):
+        try:
+            pid = int(file(pidfile).read())
+        except:
+            raise FatalError(_('failed to get buildbot PID'))
+
+        os.kill(pid, signal.SIGHUP)
+
 
 register_command(cmd_bot)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]