diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/env_prepare/quota_prepare.py | 27 | ||||
-rw-r--r-- | utils/env_prepare/stack_prepare.py | 14 | ||||
-rw-r--r-- | utils/infra_setup/runner/docker_env.py | 2 |
3 files changed, 39 insertions, 4 deletions
diff --git a/utils/env_prepare/quota_prepare.py b/utils/env_prepare/quota_prepare.py index 267e70ab..8dcdf3d6 100644 --- a/utils/env_prepare/quota_prepare.py +++ b/utils/env_prepare/quota_prepare.py @@ -42,14 +42,37 @@ nova_quota = {"ram": -1, "injected_file_path_bytes": -1} +def check_https_enabled(): + LOG.debug("Check if https is enabled in OpenStack") + os_auth_url = os.getenv('OS_AUTH_URL') + if os_auth_url.startswith('https'): + LOG.debug("https is enabled") + return True + LOG.debug("https is not enabled") + return False + + def quota_env_prepare(): + https_enabled = check_https_enabled() + insecure_option = '' + insecure = os.getenv('OS_INSECURE',) + if https_enabled: + LOG.info("https is enabled") + if insecure: + if insecure.lower() == "true": + insecure_option = ' --insecure ' + else: + LOG.warn("Env variable OS_INSECURE is {}: if https + no " + "credential used, it should be set as True." + .format(insecure)) + tenant_name = os.getenv("OS_TENANT_NAME") - cmd = ("openstack project list | grep " + + cmd = ("openstack {} project list | grep ".format(insecure_option) + tenant_name + " | awk '{print $2}'") result = commands.getstatusoutput(cmd) - if result[0] == 0: + if result[0] == 0 and 'exception' not in result[1]: LOG.info("Get %s project id is %s" % (tenant_name, result[1])) else: LOG.error("can't get openstack project id") diff --git a/utils/env_prepare/stack_prepare.py b/utils/env_prepare/stack_prepare.py index 25c2a29b..640afa13 100644 --- a/utils/env_prepare/stack_prepare.py +++ b/utils/env_prepare/stack_prepare.py @@ -37,6 +37,16 @@ def _prepare_env_daemon(test_yardstick): config.bottlenecks_config["yardstick_rc_dir"]) docker_env.docker_exec_cmd(yardstick_contain, cmd) + file_orig = ("/home/opnfv/repos/yardstick/etc" + "/yardstick/yardstick.conf.sample") + file_after = "/etc/yardstick/yardstick.conf" + cmd = "cp %s %s" % (file_orig, + file_after) + docker_env.docker_exec_cmd(yardstick_contain, + cmd) + cmd = "sed -i '12s/http/file/g' /etc/yardstick/yardstick.conf" + docker_env.docker_exec_cmd(yardstick_contain, + cmd) # update the external_network _source_file(rc_file) @@ -73,7 +83,9 @@ def _source_file(rc_file): p = subprocess.Popen(". %s; env" % rc_file, stdout=subprocess.PIPE, shell=True) output = p.communicate()[0] - env = dict((line.split('=', 1) for line in output.splitlines())) + output_lines = output.splitlines() + del output_lines[5] + env = dict((line.split('=', 1) for line in output_lines)) os.environ.update(env) return env diff --git a/utils/infra_setup/runner/docker_env.py b/utils/infra_setup/runner/docker_env.py index 438d3d19..54478ffc 100644 --- a/utils/infra_setup/runner/docker_env.py +++ b/utils/infra_setup/runner/docker_env.py @@ -45,7 +45,7 @@ def env_yardstick(docker_name): volume = get_self_volume() yardstick_tag = os.getenv("Yardstick_TAG") if yardstick_tag is None: - yardstick_tag = "latest" + yardstick_tag = "danube.3.1" env_docker = client.containers.run(image="opnfv/yardstick:%s" % yardstick_tag, privileged=True, |