mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Deal with server.security_groups being None (#24742)
It shouldn't happen - but there is a bug in shade where it can be None but should be [] instead. Work around it. Fixes #24675
This commit is contained in:
parent
3ad09604f2
commit
6e85ac2ba6
1 changed files with 5 additions and 1 deletions
|
@ -631,7 +631,11 @@ def _check_security_groups(module, cloud, server):
|
|||
return changed, server
|
||||
|
||||
module_security_groups = set(module.params['security_groups'])
|
||||
server_security_groups = set(sg.name for sg in server.security_groups)
|
||||
# Workaround a bug in shade <= 1.20.0
|
||||
if server.security_groups is not None:
|
||||
server_security_groups = set(sg.name for sg in server.security_groups)
|
||||
else:
|
||||
server_security_groups = set()
|
||||
|
||||
add_sgs = module_security_groups - server_security_groups
|
||||
remove_sgs = server_security_groups - module_security_groups
|
||||
|
|
Loading…
Reference in a new issue