mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #38183 from cro/fix_37891
Fix bad set operations when setting up securitygroups in AWS.
This commit is contained in:
commit
c638952684
1 changed files with 6 additions and 5 deletions
|
@ -1159,11 +1159,12 @@ def securitygroupid(vm_):
|
|||
securitygroupid_list = config.get_cloud_config_value(
|
||||
'securitygroupid', vm_, __opts__, search_global=False
|
||||
)
|
||||
# If the list is None, then the set will remain empty
|
||||
# If the list is already a set then calling 'set' on it is a no-op
|
||||
# If the list is a string, then calling 'set' generates a one-element set
|
||||
# If the list is anything else, stacktrace
|
||||
if securitygroupid_list:
|
||||
if isinstance(securitygroupid_list, list):
|
||||
securitygroupid_set.union(securitygroupid_list)
|
||||
else:
|
||||
securitygroupid_set.add(securitygroupid_list)
|
||||
securitygroupid_set = securitygroupid_set.union(set(securitygroupid_list))
|
||||
|
||||
securitygroupname_list = config.get_cloud_config_value(
|
||||
'securitygroupname', vm_, __opts__, search_global=False
|
||||
|
@ -1178,7 +1179,7 @@ def securitygroupid(vm_):
|
|||
log.debug('AWS SecurityGroup ID of {0} is {1}'.format(
|
||||
sg['groupName'], sg['groupId'])
|
||||
)
|
||||
securitygroupid_set.add(sg['groupId'])
|
||||
securitygroupid_set = securitygroupid_set.add(sg['groupId'])
|
||||
return list(securitygroupid_set)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue