changeset 250:48bc52d51252

make irc configurable
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 28 Dec 2011 11:07:38 -0800
parents 76b4f58df3ee
children 911af6a47544
files autobot/config.py autobot/template.py autobot/template/master/master.cfg autobot/template/master/master.ini
diffstat 4 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/autobot/config.py	Wed Dec 28 10:27:51 2011 -0800
+++ b/autobot/config.py	Wed Dec 28 11:07:38 2011 -0800
@@ -25,6 +25,11 @@
         self.master = self.section_dict(master)
         for port, default in ('slaveport', 9010), ('htmlport', 8010), ('publichtmlport', 8011):
             self.master[port] = int(self.master.get(port) or default)
+        channels = self.master.get('channels', '').strip()
+        if channels:
+            self.master['channels'] = channels.split()
+        else:
+            self.master['channels'] = []
 
         # get section information
         self.slaves = {}
--- a/autobot/template.py	Wed Dec 28 10:27:51 2011 -0800
+++ b/autobot/template.py	Wed Dec 28 11:07:38 2011 -0800
@@ -51,7 +51,10 @@
             Variable('passwd', 'buildslave password', default='passwd'),
             Variable('slaveport', 'port to talk to slaves on', default=9010, cast=int),
             Variable('htmlport', 'port for waterfall display', default=8010, cast=int),
-            Variable('publichtmlport', 'port for public waterfall display', default=8011, cast=int)]
+            Variable('publichtmlport', 'port for public waterfall display', default=8011, cast=int),
+            Variable('botname', 'name of IRC bot', default='autobot'),
+            Variable('ircHost', 'IRC host', default='irc.mozilla.org')
+            Variable('ircChannels', 'channels for the IRC bot', default='#ateam')
 
     def pre(self, variables, output):
         factory = variables.get('factories')
--- a/autobot/template/master/master.cfg	Wed Dec 28 10:27:51 2011 -0800
+++ b/autobot/template/master/master.cfg	Wed Dec 28 11:07:38 2011 -0800
@@ -114,8 +114,11 @@
 
 # irc bot
 from buildbot.status import words
-c['status'].append(words.IRC(host="irc.mozilla.org", nick="autobot",
-                             channels=["#ateam"]))
+irc = config.master.get('irc', '')
+if '@' in irc and config.master['channels']:
+    irc_host, nick = irc.split('@', 1):
+    c['status'].append(words.IRC(host=irc_host, nick=nick
+                                 channels=config.master['channels']))
 
 
 ####### PROJECT IDENTITY
--- a/autobot/template/master/master.ini	Wed Dec 28 10:27:51 2011 -0800
+++ b/autobot/template/master/master.ini	Wed Dec 28 11:07:38 2011 -0800
@@ -6,6 +6,8 @@
 publichtmlport = {{publichtmlport}}
 pollInterval = 30
 treeStableTimer = 30
+irc = {{botname}}@{{ircHost}}
+ircChannels = {{ircChannels}}
 
 [slave:{{slave}}]
 os = {{os}}