From 0ce074417403edfe82aad05205366491b16f111e Mon Sep 17 00:00:00 2001 From: Zhijiang Hu Date: Sat, 5 Aug 2017 08:25:35 +0800 Subject: Revert "Optimize list express to list generator" This reverts commit e5a787046aff97a9925a35874d2b6535a9a41c0c. Trying to solve [1] Deploy failed!!!.Traceback (most recent call last): File "/home/daisy/deploy/tempest.py", line 94, in prepare_install host_interface_map, vip, isbare) File "/home/daisy/deploy/tempest.py", line 216, in add_hosts_interface add_host_role(cluster_id, host['id'], host_name, host['name'], vip) File "/home/daisy/deploy/tempest.py", line 225, in add_host_role role.name == "COMPUTER"][0] IndexError: list index out of range [1] https://build.opnfv.org/ci/job/daisy-deploy-daily-master/626/consoleFull Change-Id: I4017b4b38fa350a28d9e9dd5b157caab885a80d0 Signed-off-by: Zhijiang Hu --- deploy/tempest.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/deploy/tempest.py b/deploy/tempest.py index f9f9e978..b154e72d 100644 --- a/deploy/tempest.py +++ b/deploy/tempest.py @@ -219,9 +219,10 @@ 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) - lb_role_id = [role.id for role in role_list_generator if + role_list = [role for role in role_list_generator] + lb_role_id = [role.id for role in role_list if role.name == "CONTROLLER_LB"][0] - computer_role_id = [role.id for role in role_list_generator if + computer_role_id = [role.id for role in role_list if role.name == "COMPUTER"][0] if host_exp_name in ['all_in_one']: role_lb_update_meta = {'nodes': [host_id], -- cgit 1.2.3-korg