Fixed some tests.
Some subnets were bogus so fixed that. Fixed issue where EC2-Classic was not respected. RDS Deepcopy was breaking on subnet generator
This commit is contained in:
parent
d935e0995f
commit
9ddf7fe436
4 changed files with 26 additions and 15 deletions
|
|
@ -567,13 +567,17 @@ class Instance(TaggedEC2Resource, BotoInstance):
|
|||
def prep_nics(self, nic_spec, private_ip=None, associate_public_ip=None):
|
||||
self.nics = {}
|
||||
|
||||
subnet = self.ec2_backend.get_subnet(self.subnet_id)
|
||||
if not private_ip:
|
||||
private_ip = subnet.get_available_subnet_ip(instance=self)
|
||||
else:
|
||||
subnet.request_ip(private_ip, instance=self)
|
||||
if self.subnet_id:
|
||||
subnet = self.ec2_backend.get_subnet(self.subnet_id)
|
||||
if not private_ip:
|
||||
private_ip = subnet.get_available_subnet_ip(instance=self)
|
||||
else:
|
||||
subnet.request_ip(private_ip, instance=self)
|
||||
|
||||
self._private_ips.add(private_ip)
|
||||
self._private_ips.add(private_ip)
|
||||
elif private_ip is None:
|
||||
# Preserve old behaviour if in EC2-Classic mode
|
||||
private_ip = random_private_ip()
|
||||
|
||||
# Primary NIC defaults
|
||||
primary_nic = {'SubnetId': self.subnet_id,
|
||||
|
|
@ -2136,7 +2140,7 @@ class Subnet(TaggedEC2Resource):
|
|||
self.id = subnet_id
|
||||
self.vpc_id = vpc_id
|
||||
self.cidr_block = cidr_block
|
||||
self.cidr = ipaddress.ip_network(self.cidr_block)
|
||||
self.cidr = ipaddress.ip_network(six.text_type(self.cidr_block))
|
||||
self._availability_zone = availability_zone
|
||||
self.default_for_az = default_for_az
|
||||
self.map_public_ip_on_launch = map_public_ip_on_launch
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue