aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/common/utils.py
diff options
context:
space:
mode:
authorchenjiankun <chenjiankun1@huawei.com>2017-06-27 03:20:08 +0000
committerchenjiankun <chenjiankun1@huawei.com>2017-07-17 00:58:09 +0000
commit3cc7480d6af4c40fe9c14f50e365337619768cf5 (patch)
treeba89f005addb4a305abb3b6f59cd4853feab040b /yardstick/common/utils.py
parentfb86be55d52f6cefd4e0de4b857ac76d00a9e681 (diff)
Kubernetes (k8s) support
JIRA: YARDSTICK-682 We decide to support k8s in E release. We need to discuss with openretriver team and then rewrite the ping test case under k8s as the first step. Change-Id: I3f81ebca8de5c1f3a8b7d42581cd7342dc320239 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
Diffstat (limited to 'yardstick/common/utils.py')
-rw-r--r--yardstick/common/utils.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/yardstick/common/utils.py b/yardstick/common/utils.py
index 0c0bac934..a4f7b30dc 100644
--- a/yardstick/common/utils.py
+++ b/yardstick/common/utils.py
@@ -124,6 +124,14 @@ def makedirs(d):
raise
+def remove_file(path):
+ try:
+ os.remove(path)
+ except OSError as e:
+ if e.errno != errno.ENOENT:
+ raise
+
+
def execute_command(cmd):
exec_msg = "Executing command: '%s'" % cmd
logger.debug(exec_msg)
@@ -242,3 +250,16 @@ def change_obj_to_dict(obj):
except TypeError:
dic.update({k: v})
return dic
+
+
+def set_dict_value(dic, keys, value):
+ return_dic = dic
+
+ for key in keys.split('.'):
+
+ return_dic.setdefault(key, {})
+ if key == keys.split('.')[-1]:
+ return_dic[key] = value
+ else:
+ return_dic = return_dic[key]
+ return dic