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

This commit is contained in:
Zuul 2020-03-07 13:42:04 +00:00 committed by Gerrit Code Review
commit f465fed028
1 changed files with 8 additions and 0 deletions

View File

@ -679,6 +679,14 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase):
pager = base_obj.Pager( pager = base_obj.Pager(
sorts=sorts, marker=marker, limit=limit, page_reverse=page_reverse) 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 # NOTE(slaweq): use admin context here to be able to get all rules
# which fits filters' criteria. Later in policy engine rules will be # which fits filters' criteria. Later in policy engine rules will be
# filtered and only those which are allowed according to policy will # filtered and only those which are allowed according to policy will