diff options
author | Yu Yang (Gabriel) <Gabriel.yuyang@huawei.com> | 2018-08-11 02:34:47 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-08-11 02:34:47 +0000 |
commit | 976ebf4916c7c6487bf98d8c14f985ff9c2dabac (patch) | |
tree | d22a504e68df9f4c165442260d413913a8b69b08 /utils/k8s_setup/k8s_utils.py | |
parent | 61467d8cb860cd3e3aebe64b5dc09813052ddc87 (diff) | |
parent | 13fd26c9dfdfbe70eba3da738cc932814b072b92 (diff) |
Merge "add k8s test configs preparation"
Diffstat (limited to 'utils/k8s_setup/k8s_utils.py')
-rw-r--r-- | utils/k8s_setup/k8s_utils.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/utils/k8s_setup/k8s_utils.py b/utils/k8s_setup/k8s_utils.py new file mode 100644 index 00000000..afcdb307 --- /dev/null +++ b/utils/k8s_setup/k8s_utils.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +############################################################################## +# Copyright (c) 2018 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 +############################################################################## + +import os +import utils.logger as log + +LOG = log.Logger(__name__).getLogger() +INSTALLER_TYPE = os.getenv("INSTALLER_TYPE") + + +def get_config_path(INSTALLER_TYPE=None, CONFIG_PATH="/tmp/k8s_config"): + if INSTALLER_TYPE: + CMD = "bash k8s_config_pre.sh -i " + INSTALLER_TYPE + \ + " -c " + CONFIG_PATH + LOG.info("Executing command: " + CMD) + CONFIG_PATH = os.popen(CMD) + else: + if not os.path.exists(CONFIG_PATH): + raise Exception("Must at least specify the path \ +of k8s config!") + return CONFIG_PATH |