forked from shippableSamples/sample-python-codedeploy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwait_for_completion.py
More file actions
22 lines (19 loc) · 605 Bytes
/
wait_for_completion.py
File metadata and controls
22 lines (19 loc) · 605 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import json
import sys, time
import subprocess
deploymentInfo = json.loads(sys.stdin.read())
deploymentId = deploymentInfo['deploymentId']
def probe(deploymentId):
result = json.loads(subprocess.check_output(['aws', 'deploy', 'get-deployment', '--deployment-id', deploymentId]))
return result['deploymentInfo']['status']
while True:
status = probe(deploymentId)
if status == 'Failed':
print 'Deployment failed'
sys.exit(1)
elif status == 'Succeeded':
print 'Deployment succeeded'
sys.exit()
else:
print 'Deployment in progress. Waiting...'
time.sleep(5)