os_nova_host_aggregate - Fix aggregate delete with hosts (#53166)

Aggregate delete task will fail in case it has hosts within the aggregate.
As by the OpenStack, the hosts should be removed from the aggregate
prior aggregate delete.

Add remove host in case provided.
pull/56306/head
Maxim Babushkin 5 years ago committed by ansibot
parent 46c44a4359
commit 45ee165fcd

@ -167,6 +167,9 @@ def main():
if aggregate is None:
changed = False
else:
if hosts:
for h in hosts:
cloud.remove_host_from_aggregate(aggregate.id, h)
cloud.delete_aggregate(aggregate.id)
changed = True
module.exit_json(changed=changed)

Loading…
Cancel
Save