Skip to content

Commit

Permalink
Temporary workaround a data issue in boskos service (kubernetes-sigs#699
Browse files Browse the repository at this point in the history
)
  • Loading branch information
harishspqr authored and k8s-ci-robot committed Apr 4, 2019
1 parent 7899d1f commit 7759225
Showing 1 changed file with 14 additions and 6 deletions.
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']

0 comments on commit 7759225

Please sign in to comment.