aboutsummaryrefslogtreecommitdiffstats
path: root/func
diff options
context:
space:
mode:
authorzhifeng.jiang <jiang.zhifeng@zte.com.cn>2016-09-15 15:01:38 +0800
committerzhifeng.jiang <jiang.zhifeng@zte.com.cn>2016-09-15 15:56:44 +0800
commitfac2a3bff97efed6d4e50bfe249c8107100b8f52 (patch)
treea7e7bf2ae5b4147e0600a62d3e7cfc996d859f34 /func
parent471817a86ae20cb288347fbedcb865ac7e31e60f (diff)
Bugfix:iperf benchmark run failed "privateip1 is undefined"
modification: get privatedip1 var when role is '2-host' run on localhost once instead of twice Change-Id: I4155f2d0c45208c4a2a0e2844fdf87acb5c8575e Signed-off-by: zhifeng.jiang <jiang.zhifeng@zte.com.cn>
Diffstat (limited to 'func')
-rw-r--r--func/driver.py8
-rw-r--r--func/env_setup.py2
2 files changed, 6 insertions, 4 deletions
diff --git a/func/driver.py b/func/driver.py
index 859e7f34..726016a5 100644
--- a/func/driver.py
+++ b/func/driver.py
@@ -45,12 +45,16 @@ class Driver:
def get_special_var_json(self, role, roles, benchmark_detail, pip_dict):
special_json = {}
index = roles.index(role) + 1
- special_json.update({'role': role[0]})
- private_ip = pip_dict[0][1] if pip_dict[0][1][0] else 'NONE'
+ private_ip = pip_dict[0][1][0] if pip_dict[0][1][0] else 'NONE'
map(lambda x: special_json.update({'ip' + str(index): x}), role[1])\
if benchmark_detail and (role[0] == '1-server') else None
map(lambda x: special_json.update({'privateip' + str(index): private_ip}), role[1])\
if benchmark_detail and (role[0] == '1-server') else None
+ special_json = self.get_special_var_json(filter(lambda x: x[0] == '1-server', roles)[0],
+ roles,
+ benchmark_detail,
+ pip_dict) if role[0] == '2-host' else special_json
+ special_json.update({'role': role[0]})
return special_json
def run_ansible_playbook(self, benchmark, extra_vars):
diff --git a/func/env_setup.py b/func/env_setup.py
index f6b1d43b..96f984cb 100644
--- a/func/env_setup.py
+++ b/func/env_setup.py
@@ -54,8 +54,6 @@ class Env_setup:
num = len(role[k])
for x in range(num):
f_name_2.write(role[k][x] + '\n')
- f_name_2.write('[localhost]\n')
- f_name_2.write('127.0.0.1\n')
f_name_2.close()
@staticmethod