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
pull/24738/head
Monty Taylor 7 years ago committed by Matt Martz
parent 3ad09604f2
commit 6e85ac2ba6

@ -631,7 +631,11 @@ def _check_security_groups(module, cloud, server):
return changed, server
module_security_groups = set(module.params['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…
Cancel
Save