aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/common/utils.py
diff options
context:
space:
mode:
authorchenjiankun <chenjiankun1@huawei.com>2017-07-13 06:14:43 +0000
committerchenjiankun <chenjiankun1@huawei.com>2017-07-13 07:12:47 +0000
commitcc3c7796ccb30b021c219cabdbe73bfc14fb38cc (patch)
tree95e3b5468ee76e4d8e023fad7a43775fa6213ef2 /yardstick/common/utils.py
parent49be6a8c0f42c9a12af305721beac95285f74b2b (diff)
Add API to get environments
JIRA: YARDSTICK-716 API: /api/v2/yardstick/environments METHOD: GET Change-Id: I46b7fb2b143fe76b6a0edbf1ecc8281187b85918 Signed-off-by: chenjiankun <chenjiankun1@huawei.com>
Diffstat (limited to 'yardstick/common/utils.py')
-rw-r--r--yardstick/common/utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/yardstick/common/utils.py b/yardstick/common/utils.py
index 1faba4d9e..0c0bac934 100644
--- a/yardstick/common/utils.py
+++ b/yardstick/common/utils.py
@@ -232,3 +232,13 @@ def result_handler(status, data):
'result': data
}
return jsonify(result)
+
+
+def change_obj_to_dict(obj):
+ dic = {}
+ for k, v in vars(obj).items():
+ try:
+ vars(v)
+ except TypeError:
+ dic.update({k: v})
+ return dic