summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Holland <william.holland@codethink.co.uk>2015-09-28 08:45:06 +0100
committerWill Holland <william.holland@codethink.co.uk>2015-09-28 08:45:06 +0100
commite278772c8ef5589bc2c4d49c1aba977bf46c2b24 (patch)
treeea260c10e7e7821d8732ca660fe508a4cfea0140
parent7be7f55b9a1149d3209c2bbf057ceb984e4f43c6 (diff)
downloadorchestration-e278772c8ef5589bc2c4d49c1aba977bf46c2b24.tar.gz
When a system is built add it to a list
This list can be used to evaluate which clusters can be deployed
-rw-r--r--source/bottlerock.py3
-rw-r--r--source/ciat_deployer.py21
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))