Implement vpc-id Instance filter
This commit is contained in:
parent
41282c9e48
commit
faa55efe21
3 changed files with 30 additions and 0 deletions
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -274,6 +274,7 @@ filter_dict_attribute_mapping = {
|
|||
'instance-id': 'id',
|
||||
'state-reason-code': '_state_reason.code',
|
||||
'source-dest-check': 'source_dest_check',
|
||||
'vpc-id': 'vpc_id',
|
||||
}
|
||||
|
||||
def get_instance_value(instance, instance_attr):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue