From 815bb8846c690b4acb6e4425c16f8abc44e9cad3 Mon Sep 17 00:00:00 2001 From: Steve Pulec Date: Fri, 28 Mar 2014 16:37:55 -0400 Subject: [PATCH] Change subnets to only have a reference to the vpc_id. --- moto/ec2/models.py | 7 +++---- moto/ec2/responses/subnets.py | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/moto/ec2/models.py b/moto/ec2/models.py index 7044de100..57e7e7dc2 100644 --- a/moto/ec2/models.py +++ b/moto/ec2/models.py @@ -682,9 +682,9 @@ class VPCBackend(object): class Subnet(object): - def __init__(self, subnet_id, vpc, cidr_block): + def __init__(self, subnet_id, vpc_id, cidr_block): self.id = subnet_id - self.vpc = vpc + self.vpc_id = vpc_id self.cidr_block = cidr_block @classmethod @@ -710,8 +710,7 @@ class SubnetBackend(object): def create_subnet(self, vpc_id, cidr_block): subnet_id = random_subnet_id() - vpc = self.get_vpc(vpc_id) - subnet = Subnet(subnet_id, vpc, cidr_block) + subnet = Subnet(subnet_id, vpc_id, cidr_block) self.subnets[subnet_id] = subnet return subnet diff --git a/moto/ec2/responses/subnets.py b/moto/ec2/responses/subnets.py index 754982214..c4fce1662 100644 --- a/moto/ec2/responses/subnets.py +++ b/moto/ec2/responses/subnets.py @@ -33,7 +33,7 @@ CREATE_SUBNET_RESPONSE = """ {{ subnet.id }} pending - {{ subnet.vpc.id }} + {{ subnet.vpc_id }} {{ subnet.cidr_block }} 251 us-east-1a @@ -55,7 +55,7 @@ DESCRIBE_SUBNETS_RESPONSE = """ {{ subnet.id }} available - {{ subnet.vpc.id }} + {{ subnet.vpc_id }} {{ subnet.cidr_block }} 251 us-east-1a