[sdc] docker file fix for cassandra
[sdc.git] / openecomp-be / lib / openecomp-sdc-translator-lib / openecomp-sdc-translator-core / src / test / resources / mock / services / heattotosca / securityrulestoportconnection / securityrulestoportconnectiongetresource / inputfiles / check_availability.py
1 #!/usr/local/bin/python2.7
2 import argparse
3 import requests
4 import sys
5 from time import sleep
6
7 conductor_url = "http://{0}:8084/MaveriQConductor/isReady"
8 check_api = "http://{0}:8084/MaveriQManager/api/Inventory/isReady"
9 check_user = "omniq"
10 check_password = "radcom"
11
12
13 PARSER = argparse.ArgumentParser()
14 PARSER.add_argument("ScribeIP", type=str,
15                     help="The Stage the application is currently in")
16 ARGS = PARSER.parse_args()
17
18 print "Begining check availability check!"
19 isConnected = False
20 while isConnected is False:
21     try:
22         sys.stdout.write('.')
23         sleep(2)
24         if requests.get(conductor_url.format(ARGS.ScribeIP),
25                         headers={'Connection': 'close'}).status_code is 200 and requests.get(
26             check_api.format(ARGS.ScribeIP,
27                              headers={'Connection': 'close'}),
28             auth=requests.auth.HTTPBasicAuth(check_user,
29                                              check_password)).status_code is 200:
30             isConnected = True
31     except requests.exceptions.ConnectionError as e:
32         sleep(2)
33
34 print 'Conductor and Scribe are ready!'