From 47708e0172d19786e7d2429e9a97384b51e7aa37 Mon Sep 17 00:00:00 2001 From: Christian Rohmann Date: Fri, 28 May 2021 16:27:31 +0200 Subject: [PATCH] Fix host_aggregate to tolerate aggregate.hosts being None Story: 2008925 Task: 42524 Change-Id: I0b2f8d0578b764ba3484d45c212f81ad728072e5 --- plugins/modules/host_aggregate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/modules/host_aggregate.py b/plugins/modules/host_aggregate.py index 303a3d8a..b79fe44e 100644 --- a/plugins/modules/host_aggregate.py +++ b/plugins/modules/host_aggregate.py @@ -126,14 +126,14 @@ def _update_hosts(cloud, aggregate, hosts, purge_hosts): if hosts is None: return - hosts_to_add = set(hosts) - set(aggregate.hosts) + hosts_to_add = set(hosts) - set(aggregate.get("hosts", [])) for i in hosts_to_add: cloud.add_host_to_aggregate(aggregate.id, i) if not purge_hosts: return - hosts_to_remove = set(aggregate.hosts) - set(hosts) + hosts_to_remove = set(aggregate.get("hosts", [])) - set(hosts) for i in hosts_to_remove: cloud.remove_host_from_aggregate(aggregate.id, i)