Fix network port unprovision

Ansible step "Unprovision instance network ports" is failing
with "Error managing network ports 'NoneType' object is not
subscriptable" because the 'hostname_role_map' is None in
the unprovision case.

Move the code accessing it into the state 'present' code
block.

Partial-Implements: blueprint network-data-v2-ports
Change-Id: If66c9974b574813e6c24c1f8b4045bf839056988
This commit is contained in:
Harald Jensås 2021-01-26 20:02:39 +01:00
parent ad5a1f9577
commit fc559ca68c
1 changed files with 1 additions and 1 deletions

View File

@ -458,8 +458,8 @@ def manage_instances_ports(result, conn, stack, instances, concurrency, state,
with futures.ThreadPoolExecutor(max_workers=concurrency) as p:
for instance in instances:
ironic_uuid = uuid_by_hostname.get(instance['hostname'])
role = hostname_role_map[instance['hostname']]
if state == 'present':
role = hostname_role_map[instance['hostname']]
provision_jobs.append(
p.submit(_provision_ports,
result,