The script launch_db.sh will print "Already Exists" logs when the DB has been
initialized by the data stored in JumpHost.
Ignore this kind of logs because it won't affect the launch of the DB but
it will confuse users.
JIRA: DOVETAIL-557
Change-Id: I23616b10bbadc49888731e943d0a4ee4425045f5
Signed-off-by: xudan <xudan16@huawei.com>
testapi_port = sys.argv[2]
target_url = 'http://{}:{}/api/v1'.format(db_host_ip, testapi_port)
-print(target_url)
dir_path = os.path.dirname(os.path.realpath(__file__))
def post(url, data):
headers = {'Content-Type': 'application/json'}
res = requests.post(url, data=json.dumps(data), headers=headers)
- print(res.text)
+ try:
+ status_code = vars(res)["status_code"]
+ if (status_code == 403 and "Already Exists" in vars(res)["_content"]) \
+ or status_code == 200:
+ return
+ else:
+ print(res.text)
+ except Exception as e:
+ print("Error: exception {}.".format(e))
def pod():
for c in cases["testcases"]:
target = '{}/projects/{}/cases'.format(target_url,
c['project_name'])
- print(target)
post(target, c)
except:
print("useless data")