diff options
Diffstat (limited to 'api')
-rw-r--r-- | api/resources/env_action.py | 19 | ||||
-rw-r--r-- | api/swagger/docs/release_action.yaml | 8 | ||||
-rw-r--r-- | api/swagger/docs/results.yaml | 8 | ||||
-rw-r--r-- | api/swagger/docs/testsuites_action.yaml | 8 |
4 files changed, 37 insertions, 6 deletions
diff --git a/api/resources/env_action.py b/api/resources/env_action.py index 2d3496cbc..9d1686a1d 100644 --- a/api/resources/env_action.py +++ b/api/resources/env_action.py @@ -27,6 +27,7 @@ from api.utils.common import result_handler from docker import Client from yardstick.common import constants as config from yardstick.common import utils as yardstick_utils +from yardstick.common import openstack_utils from yardstick.common.httpClient import HttpClient logger = logging.getLogger(__name__) @@ -194,6 +195,13 @@ def prepareYardstickEnv(args): return result_handler('success', {'task_id': task_id}) +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']) + + def _prepare_env_daemon(task_id): _create_task(task_id) @@ -207,11 +215,10 @@ def _prepare_env_daemon(task_id): rc_file = config.OPENSTACK_RC_FILE - _get_remote_rc_file(rc_file, installer_ip, installer_type) - - _source_file(rc_file) - - _append_external_network(rc_file) + if not _already_source_openrc(): + _get_remote_rc_file(rc_file, installer_ip, installer_type) + _source_file(rc_file) + _append_external_network(rc_file) # update the external_network _source_file(rc_file) @@ -263,7 +270,7 @@ def _get_remote_rc_file(rc_file, installer_ip, installer_type): def _append_external_network(rc_file): - neutron_client = yardstick_utils.get_neutron_client() + neutron_client = openstack_utils.get_neutron_client() networks = neutron_client.list_networks()['networks'] try: ext_network = next(n['name'] for n in networks if n['router:external']) diff --git a/api/swagger/docs/release_action.yaml b/api/swagger/docs/release_action.yaml index 7bfe5e647..0e08e582f 100644 --- a/api/swagger/docs/release_action.yaml +++ b/api/swagger/docs/release_action.yaml @@ -1,3 +1,11 @@ +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## TestCases Actions
This API may offer many actions, including runTestCase
diff --git a/api/swagger/docs/results.yaml b/api/swagger/docs/results.yaml index 7bdab3eb6..00b159003 100644 --- a/api/swagger/docs/results.yaml +++ b/api/swagger/docs/results.yaml @@ -1,3 +1,11 @@ +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## Query task result data This api offer the interface to get the result data via task_id diff --git a/api/swagger/docs/testsuites_action.yaml b/api/swagger/docs/testsuites_action.yaml index ebf01e4ec..ca8d22738 100644 --- a/api/swagger/docs/testsuites_action.yaml +++ b/api/swagger/docs/testsuites_action.yaml @@ -1,3 +1,11 @@ +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## TestSuites Actions This API may offer many actions, including runTestSuite |