Implement vpc-id Instance filter

This commit is contained in:
Hugo Lopes Tavares 2014-11-05 11:06:14 -05:00
commit faa55efe21
3 changed files with 30 additions and 0 deletions

View file

@ -286,6 +286,7 @@ class Instance(BotoInstance, TaggedEC2Resource):
self.user_data = user_data
self.security_groups = security_groups
self.instance_type = kwargs.get("instance_type", "m1.small")
self.vpc_id = None
self.subnet_id = kwargs.get("subnet_id")
self.key_name = kwargs.get("key_name")
self.source_dest_check = "true"
@ -309,6 +310,10 @@ class Instance(BotoInstance, TaggedEC2Resource):
# string will have a "u" prefix -- need to get rid of it
self.user_data[0] = self.user_data[0].encode('utf-8')
if self.subnet_id:
subnet = ec2_backend.get_subnet(self.subnet_id)
self.vpc_id = subnet.vpc_id
self.prep_nics(kwargs.get("nics", {}),
subnet_id=kwargs.get("subnet_id",None),
private_ip=kwargs.get("private_ip",None),