The launcher can now provide configuration files.
authorsalimfadhley <sal@stodge.org>
Thu, 20 Jun 2013 00:05:32 +0000 (01:05 +0100)
committersalimfadhley <sal@stodge.org>
Thu, 20 Jun 2013 00:09:57 +0000 (01:09 +0100)
jenkinsapi_utils/jenkins_launcher.py

index e52d3c5..5918d18 100644 (file)
@@ -6,6 +6,7 @@ import logging
 import tempfile
 import threading
 import subprocess
+import pkg_resources
 
 log = logging.getLogger(__name__)
 
@@ -62,6 +63,12 @@ class JenkinsLancher(object):
             log.info("Redownloading Jenkins")
             subprocess.check_call('./get-jenkins-war.sh')
 
+    def update_config(self):
+        config_dest = os.path.join(self.jenkins_home, 'config.xml')
+        config_dest_file = open(config_dest,'w')
+        config_source = pkg_resources.resource_string('jenkinsapi_tests.systests', 'config.xml')
+        config_dest_file.write(config_source.encode('UTF-8'))
+
     def stop(self):
         log.info("Shutting down jenkins.")
         self.jenkins_process.terminate()
@@ -70,6 +77,7 @@ class JenkinsLancher(object):
 
     def start(self, timeout=30):
         self.update_war()
+        self.update_config()
 
         os.environ['JENKINS_HOME'] = self.jenkins_home
         os.chdir(self.war_directory)