Remove attribute not specified before checking duplicate sg rules

The security-group extension secgroup-local-ip-prefix allows the user to
specify a new rule attribute in the request, before passing the request
to Neutron, we must remove ATTR_NOT_SPECIFIED if the attribute was not
specified and replace it with None.
The bug is due to change: I2bd6b3381c715c1286dfa10bf3b143c73fecf49d

Closes-Bug: #1563790
Change-Id: Ie921f9e41fc6b45d521bf8f9f041c773cdd19c31
This commit is contained in:
Roey Chen 2016-03-30 03:53:17 -07:00
parent 82660993e7
commit c946784134
1 changed files with 5 additions and 0 deletions

View File

@ -56,8 +56,13 @@ class ExtendedSecurityGroupRuleMixin(object):
def _check_local_ip_prefix(self, context, rule):
rule_specify_local_ip_prefix = attr.is_attr_set(
rule.get(ext_local_ip.LOCAL_IP_PREFIX))
if rule_specify_local_ip_prefix and rule['direction'] != 'ingress':
raise NotIngressRule()
if not rule_specify_local_ip_prefix:
# remove ATTR_NOT_SPECIFIED
rule[ext_local_ip.LOCAL_IP_PREFIX] = None
return rule_specify_local_ip_prefix
def _process_security_group_rule_properties(self, context,