diff options
author | xudan <xudan16@huawei.com> | 2017-11-02 02:17:10 -0400 |
---|---|---|
committer | Leo wang <grakiss.wanglei@huawei.com> | 2017-11-06 01:28:29 +0000 |
commit | 2866e0b3a9f028eee262b65db1e377b50b3f9594 (patch) | |
tree | 16b8f79511b85493203bc88951798b5b2d79ec6e /dovetail/utils/local_db/init_db.py | |
parent | 0df52c2b1fe801b0f282c4f44aed7891a389d833 (diff) |
Bugfix: Failed to build local DB on Centos
1. The scripts for building local DB and testapi service just work on Ubuntu.
2. For Centos, they fails to do that.
3. This is mainly because of that Centos can't use the IP of the JumpHost
to connect the DB and testapi. It needs to use the internal IPs of the
DB container and the testapi container.
4. Change the IPs in the scripts to be the containers' internal IPs.
JIRA: DOVETAIL-548
Change-Id: I71aed82cb620b58bcd43ace61497db65c5bd7ecc
Signed-off-by: xudan <xudan16@huawei.com>
Diffstat (limited to 'dovetail/utils/local_db/init_db.py')
-rw-r--r-- | dovetail/utils/local_db/init_db.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/dovetail/utils/local_db/init_db.py b/dovetail/utils/local_db/init_db.py index bea3eac8..365927b5 100644 --- a/dovetail/utils/local_db/init_db.py +++ b/dovetail/utils/local_db/init_db.py @@ -10,12 +10,14 @@ import requests import json import sys +import os db_host_ip = sys.argv[1] 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 get(url): @@ -31,7 +33,7 @@ def post(url, data): def pod(): target = '{}/pods'.format(target_url) - with open('pods.json', 'r') as f: + with open(os.path.join(dir_path, 'pods.json'), 'r') as f: pods = json.load(f) for p in pods: post(target, p) @@ -39,14 +41,14 @@ def pod(): def project(): target = '{}/projects'.format(target_url) - with open('projects.json', 'r') as f: + with open(os.path.join(dir_path, 'projects.json'), 'r') as f: projects = json.load(f) for p in projects: post(target, p) def cases(): - with open('cases.json', 'r') as f: + with open(os.path.join(dir_path, 'cases.json'), 'r') as f: for line in f: try: cases = json.loads(line) |