Merge "Correct checking existence of security group rule" into stable/diablo

This commit is contained in:
Jenkins 2012-08-14 20:18:22 +00:00 committed by Gerrit Code Review
commit 837580878c
4 changed files with 1050 additions and 22 deletions

View File

@ -98,6 +98,7 @@ Mohammed Naser <mnaser@vexxhost.com>
Monsyne Dragon <mdragon@rackspace.com>
Monty Taylor <mordred@inaugust.com>
MORITA Kazutaka <morita.kazutaka@gmail.com>
MotoKen <motokentsai@gmail.com>
Muneyuki Noguchi <noguchimn@nttdata.co.jp>
Nachi Ueno <ueno.nachi@lab.ntt.co.jp>
Naveed Massjouni <naveedm9@gmail.com>

View File

@ -755,17 +755,14 @@ class CloudController(object):
defined in the given security group.
"""
for rule in security_group.rules:
if 'group_id' in values:
if rule['group_id'] == values['group_id']:
return rule['id']
else:
is_duplicate = True
for key in ('cidr', 'from_port', 'to_port', 'protocol'):
if rule[key] != values[key]:
is_duplicate = False
break
if is_duplicate:
return rule['id']
is_duplicate = True
keys = ('group_id', 'cidr', 'from_port', 'to_port', 'protocol')
for key in keys:
if rule.get(key) != values.get(key):
is_duplicate = False
break
if is_duplicate:
return rule['id']
return False
def revoke_security_group_ingress(self, context, group_name=None,

View File

@ -245,17 +245,14 @@ class SecurityGroupRulesController(SecurityGroupController):
defined in the given security group.
"""
for rule in security_group.rules:
if 'group_id' in values:
if rule['group_id'] == values['group_id']:
return True
else:
is_duplicate = True
for key in ('cidr', 'from_port', 'to_port', 'protocol'):
if rule[key] != values[key]:
is_duplicate = False
break
if is_duplicate:
return True
is_duplicate = True
keys = ('group_id', 'cidr', 'from_port', 'to_port', 'protocol')
for key in keys:
if rule.get(key) != values.get(key):
is_duplicate = False
break
if is_duplicate:
return True
return False
def _rule_args_to_dict(self, context, to_port=None, from_port=None,

File diff suppressed because it is too large Load Diff