summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhongjun <zhong.jun@zte.com.cn>2017-08-04 09:03:05 +0800
committerzhongjun <zhong.jun@zte.com.cn>2017-08-04 09:03:05 +0800
commite5a787046aff97a9925a35874d2b6535a9a41c0c (patch)
tree55aa2aa64a87755d46eef3671ee23910dee9d680
parente17dc35e2e445a7b7d52398a55d196cca8a680b3 (diff)
Optimize list express to list generator
optimize list express to list generator in tempest.py Change-Id: I8ba12d33a1fc8b33e29fa0a08d7be40a1361bb65 Signed-off-by: zhongjun <zhong.jun@zte.com.cn>
-rw-r--r--deploy/tempest.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/deploy/tempest.py b/deploy/tempest.py
index 3c1a6c7d..49fc08fb 100644
--- a/deploy/tempest.py
+++ b/deploy/tempest.py
@@ -215,10 +215,9 @@ def add_hosts_interface(cluster_id, hosts_info, hosts_name, mac_address_map,
def add_host_role(cluster_id, host_id, host_exp_name, host_real_name, vip):
role_meta = {'filters': {'cluster_id': cluster_id}}
role_list_generator = client.roles.list(**role_meta)
- role_list = [role for role in role_list_generator]
- lb_role_id = [role.id for role in role_list if
+ lb_role_id = [role.id for role in role_list_generator if
role.name == "CONTROLLER_LB"][0]
- computer_role_id = [role.id for role in role_list if
+ computer_role_id = [role.id for role in role_list_generator if
role.name == "COMPUTER"][0]
if host_exp_name in ['all_in_one']:
role_lb_update_meta = {'nodes': [host_id],