# HG changeset patch # User Jeff Hammel # Date 1294454120 28800 # Node ID 785b075be979db69137c92dc7d76dc163a86b8f0 # Parent fe1bb4c667bc327d67fef560737b4ed3676a44dd post method should work now [untested] diff -r fe1bb4c667bc -r 785b075be979 autobot/template.py --- a/autobot/template.py Fri Jan 07 18:30:46 2011 -0800 +++ b/autobot/template.py Fri Jan 07 18:35:20 2011 -0800 @@ -43,13 +43,16 @@ else: raise AssertionError("No factory provided") + def create(self, output, variables): + command = ['buildbot', 'create-master', output] + print ' '.join(command) + call(command) + def post(self, variables): """ called after the template is applied """ - command = ['buildbot', 'create-master', self.output] - print ' '.join(command) - call(command) + self.create() class AutobotSlaveTemplate(MakeItSoTemplate): name = 'autobot-slave' @@ -60,13 +63,18 @@ Variable('passwd', 'buildslave password', default='passwd'), Variable('slaveport', 'port to talk to slaves on', default=9010)] - def post(self, variables): - command = ['buildslave', 'create-slave', self.output, - 'localhost:%d' % variables['slaveport'], + def create(self, output, variables): + command = ['buildslave', 'create-slave', output, + '%s:%d' % (variables['master'], variables['slaveport']), variables['slave'], variables['passwd'] ] print ' '.join(command) call(command) + + + def post(self, variables): + self.create(self.output, variables) + class AutobotTemplate(AutobotMasterTemplate, AutobotSlaveTemplate): name = 'autobot' @@ -75,9 +83,8 @@ vars = assemble(AutobotMasterTemplate, AutobotSlaveTemplate) def post(self, variables): - # TODO: set output - AutobotMasterTemplate.post(self, variables) - AutobotMasterTemplate.slave(self, variables) + AutobotMasterTemplate.create(self, os.path.join(output, 'master'), variables) + AutobotSlaveTemplate.create(self, os.path.join(output, 'slave'), variables) # CLI front end functions # (console_script entry points)