aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/common/utils.py
diff options
context:
space:
mode:
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