Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions hack/checkout_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,26 @@
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))

Expand All @@ -47,4 +55,4 @@
print 'export BOSKOS_RESOURCE_NAME="%s";' % body['name']
print 'export AWS_ACCESS_KEY_ID="%s";' % body['userdata']['access-key-id']
print 'export AWS_SECRET_ACCESS_KEY="%s";' % body['userdata']['secret-access-key']