Merge "Ensure that default SG exists during list of SG rules API call" into stable/rocky

This commit is contained in:
Zuul 2020-03-10 12:41:56 +00:00 committed by Gerrit Code Review
commit efc2e73b75
1 changed files with 8 additions and 0 deletions

View File

@ -672,6 +672,14 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase):
pager = base_obj.Pager(
sorts=sorts, marker=marker, limit=limit, page_reverse=page_reverse)
project_id = filters.get('project_id') or filters.get('tenant_id')
if project_id:
project_id = project_id[0]
else:
project_id = context.project_id
if project_id:
self._ensure_default_security_group(context, project_id)
# NOTE(slaweq): use admin context here to be able to get all rules
# which fits filters' criteria. Later in policy engine rules will be
# filtered and only those which are allowed according to policy will