updated SC methods to work with a group_id, which must be used if it's a group in a VPC
This commit is contained in:
parent
1eac424bf5
commit
48ee4b600b
3 changed files with 21 additions and 21 deletions
|
|
@ -41,11 +41,16 @@ class SecurityGroups(object):
|
|||
|
||||
def delete_security_group(self):
|
||||
# TODO this should raise an error if there are instances in the group. See http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteSecurityGroup.html
|
||||
name = self.querystring.get('GroupName')[0]
|
||||
vpc_id = self.querystring.get("VpcId", [None])[0]
|
||||
|
||||
# needs vpc now
|
||||
group = ec2_backend.delete_security_group(name, vpc_id)
|
||||
name = self.querystring.get('GroupName')
|
||||
sg_id = self.querystring.get('GroupId')
|
||||
|
||||
if name:
|
||||
group = ec2_backend.delete_security_group(name[0])
|
||||
elif sg_id:
|
||||
group = ec2_backend.delete_security_group(group_id=sg_id[0])
|
||||
|
||||
# needs name or group now
|
||||
if not group:
|
||||
# There was no such group
|
||||
return "There was no security group with name {0}".format(name), dict(status=404)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue