From 90002e06ae0ab255d71e6976d7e5d23e93850cd3 Mon Sep 17 00:00:00 2001 From: howinator Date: Wed, 5 Oct 2016 23:32:36 -0500 Subject: [PATCH] Add subnet associations to route tables dict The main purpose of this PR is to add the subnet associations to the dict returned by ec2_vpc_route_table_facts. This commit also re-formats code to make it PEP8 compliant. --- .../cloud/amazon/ec2_vpc_route_table_facts.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_route_table_facts.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_route_table_facts.py index f270f2cbb2..be6f06c67c 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_vpc_route_table_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_route_table_facts.py @@ -74,17 +74,22 @@ def get_route_table_info(route_table): # Add any routes to array routes = [] + associations = [] for route in route_table.routes: routes.append(route.__dict__) + for association in route_table.associations: + associations.append(association.__dict__) - route_table_info = { 'id': route_table.id, - 'routes': routes, - 'tags': route_table.tags, - 'vpc_id': route_table.vpc_id - } + route_table_info = {'id': route_table.id, + 'routes': routes, + 'associations': associations, + 'tags': route_table.tags, + 'vpc_id': route_table.vpc_id + } return route_table_info + def list_ec2_vpc_route_tables(connection, module): filters = module.params.get("filters") @@ -105,7 +110,7 @@ def main(): argument_spec = ec2_argument_spec() argument_spec.update( dict( - filters = dict(default=None, type='dict') + filters=dict(default=None, type='dict') ) )