summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@yahoo.com>2010-09-28 18:47:47 -0700
committerVishvananda Ishaya <vishvananda@yahoo.com>2010-09-28 18:47:47 -0700
commitc53af2fc9d9803cebc7f4078b8f772476a09df81 (patch)
tree8aaf4579acfa57967c06559f6d9f7eeb1c1a4f0f /nova/api
parentf09fa50fd31ded3f2f31e020b54f2d3d2b380a35 (diff)
fix security group revoke
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/ec2/cloud.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py
index 4cf2666a5..6eea95f84 100644
--- a/nova/api/ec2/cloud.py
+++ b/nova/api/ec2/cloud.py
@@ -295,7 +295,7 @@ class CloudController(object):
db.security_group_get_by_name(context,
source_project_id,
source_security_group_name)
- values['group_id'] = source_security_group.id
+ values['group_id'] = source_security_group['id']
elif cidr_ip:
# If this fails, it throws an exception. This is what we want.
IPy.IP(cidr_ip)
@@ -331,17 +331,19 @@ class CloudController(object):
group_name)
criteria = self._authorize_revoke_rule_args_to_dict(context, **kwargs)
+ if criteria == None:
+ raise exception.ApiError("No rule for the specified parameters.")
for rule in security_group.rules:
+ match = True
for (k,v) in criteria.iteritems():
if getattr(rule, k, False) != v:
- break
- # If we make it here, we have a match
- db.security_group_rule_destroy(context, rule.id)
+ match = False
+ if match:
+ db.security_group_rule_destroy(context, rule['id'])
+ self._trigger_refresh_security_group(security_group)
- self._trigger_refresh_security_group(security_group)
-
- return True
+ raise exception.ApiError("No rule for the specified parameters.")
# TODO(soren): Dupe detection. Adding the same rule twice actually
# adds the same rule twice to the rule set, which is