mirror of
https://opendev.org/openstack/ansible-collections-openstack.git
synced 2026-07-29 03:04:29 +00:00
Merge "Fix host_aggregate to tolerate aggregate.hosts being None"
This commit is contained in:
@@ -126,14 +126,14 @@ def _update_hosts(cloud, aggregate, hosts, purge_hosts):
|
|||||||
if hosts is None:
|
if hosts is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
hosts_to_add = set(hosts) - set(aggregate.hosts)
|
hosts_to_add = set(hosts) - set(aggregate.get("hosts", []))
|
||||||
for i in hosts_to_add:
|
for i in hosts_to_add:
|
||||||
cloud.add_host_to_aggregate(aggregate.id, i)
|
cloud.add_host_to_aggregate(aggregate.id, i)
|
||||||
|
|
||||||
if not purge_hosts:
|
if not purge_hosts:
|
||||||
return
|
return
|
||||||
|
|
||||||
hosts_to_remove = set(aggregate.hosts) - set(hosts)
|
hosts_to_remove = set(aggregate.get("hosts", [])) - set(hosts)
|
||||||
for i in hosts_to_remove:
|
for i in hosts_to_remove:
|
||||||
cloud.remove_host_from_aggregate(aggregate.id, i)
|
cloud.remove_host_from_aggregate(aggregate.id, i)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user