diff options
-rw-r--r-- | source/bottlerock.py | 3 | ||||
-rw-r--r-- | source/ciat_deployer.py | 21 |
2 files changed, 24 insertions, 0 deletions
diff --git a/source/bottlerock.py b/source/bottlerock.py index a6e95ca..aadb4ce 100644 --- a/source/bottlerock.py +++ b/source/bottlerock.py @@ -5,6 +5,7 @@ from bottle import post, request, run, HTTPResponse import imp +import ciat_deployer orch_config = imp.load_source('orch_config', '../source/orch_config.py') LOGFILE = '../orch.log' @@ -105,11 +106,13 @@ def build_complete(): try: properties = get_form( "system", + "slave", "buildslave_scripts_sha", "definitions_sha", "testing_sha") except Status400 as p: return missing_property_response(p) + ciat_deployer.buildcomplete(properties) return sendchange('build_complete',properties) @post('/deploy_complete') diff --git a/source/ciat_deployer.py b/source/ciat_deployer.py new file mode 100644 index 0000000..aec284c --- /dev/null +++ b/source/ciat_deployer.py @@ -0,0 +1,21 @@ +BUILT_SYSTEMS_FILE = "built_systems.yaml" + +def buildcomplete(properties): + import yaml, os + global BUILT_SYSTEMS_FILE + + system = { + 'name': properties['system'] + 'slave': properties['slave'] + 'definitions_sha': properties['definitions_sha']} + + if os.path.isfile(BUILT_SYSTEMS_FILE): + with open(BUILT_SYSTEMS_FILE, 'r') as f: + built_systems = yaml.load(f) + else: + built_systems = [] + if system in built_systems: + return + built_systems.append(system) + with open(BUILT_SYSTMES_FILE, 'w') as f: + outfile.write(yaml.dump(build_systems,default_flow_style=False)) |