Temporary workaround a data issue in boskos service
@@ -27,18 +27,26 @@ BOSKOS_HOST=os.environ.get("BOSKOS_HOST", "boskos")
RESOURCE_TYPE = "aws-account"
USER = "cluster-api-provider-aws"
-if __name__ == "__main__":
- conn = httplib.HTTPConnection(BOSKOS_HOST)
-
+def post_request(conn, input_state = "free"):
conn.request("POST", "/acquire?%s" % urllib.urlencode({
'type': RESOURCE_TYPE,
'owner': USER,
- 'state': 'free',
+ 'state': input_state,
'dest': 'busy',
})
)
- resp = conn.getresponse()
+ return conn.getresponse()
+
+if __name__ == "__main__":
+ conn = httplib.HTTPConnection(BOSKOS_HOST)
+
+ resp = post_request(conn)
+ # we're working around an issue with the data in boskos.
+ # We'll remove the code that tries both free and clean once all the data is good.
+ if resp.status == 404:
+ resp = post_request(conn, "clean")
+
if resp.status != 200:
sys.exit("Got invalid response %d: %s" % (resp.status, resp.reason))
