aboutsummaryrefslogtreecommitdiffstats
path: root/api/resources/env_action.py
diff options
context:
space:
mode:
authorchenjiankun <chenjiankun1@huawei.com>2017-04-27 02:27:39 +0000
committerJing Lu <lvjing5@huawei.com>2017-05-04 01:02:25 +0000
commit6990400d9c020ed0f600e02141efec883593c6c6 (patch)
tree189b61d1fd6f7f9a7950d9891db7b2ef38c73d2d /api/resources/env_action.py
parenta87e2b84d683d10ebace26f4df7a8bbe8a801e60 (diff)
Bugfix: yardstick env prepare cmd do not support other installer
JIRA: YARDSTICK-629 Currently yardstick env prepare do not support other installer. I will add follow support: 1. Environment variable already exists: then do not fetch openrc file and do not add EXTERNAL_NETWORK variable. 2. Already have openrc file in /etc/yardstick/openstack.creds: only source this file in API. 3.Environment variable not exists and openrc file not in /etc/yardstick/openstack.creds: fetch openrc file and append EXTERNAL_NETWORK variable. Change-Id: I4ce98f2e17ef8e0a0a1c33c3862ca301c53bb6c2 Signed-off-by: chenjiankun <chenjiankun1@huawei.com> (cherry picked from commit 48ad9b5dfa80c8d05d07c6f7fa12d53deddcf3a2)
Diffstat (limited to 'api/resources/env_action.py')
-rw-r--r--api/resources/env_action.py30
1 files changed, 7 insertions, 23 deletions
diff --git a/api/resources/env_action.py b/api/resources/env_action.py
index f6f43e5ac..7bfaf27a7 100644
--- a/api/resources/env_action.py
+++ b/api/resources/env_action.py
@@ -199,30 +199,25 @@ def prepareYardstickEnv(args):
def _already_source_openrc():
"""Check if openrc is sourced already"""
return all(os.environ.get(k) for k in ['OS_AUTH_URL', 'OS_USERNAME',
- 'OS_PASSWORD', 'OS_TENANT_NAME',
- 'EXTERNAL_NETWORK'])
+ 'OS_PASSWORD', 'EXTERNAL_NETWORK'])
def _prepare_env_daemon(task_id):
_create_task(task_id)
- installer_ip = os.environ.get('INSTALLER_IP', 'undefined')
- installer_type = os.environ.get('INSTALLER_TYPE', 'undefined')
-
try:
- _check_variables(installer_ip, installer_type)
-
_create_directories()
rc_file = consts.OPENRC
if not _already_source_openrc():
- _get_remote_rc_file(rc_file, installer_ip, installer_type)
+ if not os.path.exists(rc_file):
+ installer_ip = os.environ.get('INSTALLER_IP', '192.168.200.2')
+ installer_type = os.environ.get('INSTALLER_TYPE', 'compass')
+ _get_remote_rc_file(rc_file, installer_ip, installer_type)
+ _source_file(rc_file)
+ _append_external_network(rc_file)
_source_file(rc_file)
- _append_external_network(rc_file)
-
- # update the external_network
- _source_file(rc_file)
_clean_images()
@@ -234,17 +229,6 @@ def _prepare_env_daemon(task_id):
logger.debug('Error: %s', e)
-def _check_variables(installer_ip, installer_type):
-
- if installer_ip == 'undefined':
- raise SystemExit('Missing INSTALLER_IP')
-
- if installer_type == 'undefined':
- raise SystemExit('Missing INSTALLER_TYPE')
- elif installer_type not in consts.INSTALLERS:
- raise SystemExit('INSTALLER_TYPE is not correct')
-
-
def _create_directories():
yardstick_utils.makedirs(consts.CONF_DIR)