changeset 25:785b075be979

post method should work now [untested]
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 07 Jan 2011 18:35:20 -0800
parents fe1bb4c667bc
children fdddf883c19d
files autobot/template.py
diffstat 1 files changed, 16 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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)