Remove unused vars and pass params dict to describe_peering_connections

reviewable/pr18780/r1
Mike Mochan 9 years ago committed by Toshio Kuratomi
parent 2291fc00d2
commit 8ab4963e78

@ -161,10 +161,10 @@ except ImportError:
HAS_BOTO3 = False HAS_BOTO3 = False
def describe_peering_connections(vpc_id, peer_vpc_id, client): def describe_peering_connections(params, client):
result = client.describe_vpc_peering_connections(Filters=[ result = client.describe_vpc_peering_connections(Filters=[
{'Name': 'requester-vpc-info.vpc-id', 'Values': [vpc_id]}, {'Name': 'requester-vpc-info.vpc-id', 'Values': [params['VpcId']]},
{'Name': 'accepter-vpc-info.vpc-id', 'Values': [peer_vpc_id]} {'Name': 'accepter-vpc-info.vpc-id', 'Values': [params['PeerVpcId']]}
]) ])
if result['VpcPeeringConnections'] == []: if result['VpcPeeringConnections'] == []:
result = client.describe_vpc_peering_connections(Filters=[ result = client.describe_vpc_peering_connections(Filters=[
@ -190,11 +190,7 @@ def create_peer_connection(client, module):
if module.params.get('peer_owner_id'): if module.params.get('peer_owner_id'):
params['PeerOwnerId'] = str(module.params.get('peer_owner_id')) params['PeerOwnerId'] = str(module.params.get('peer_owner_id'))
params['DryRun'] = module.check_mode params['DryRun'] = module.check_mode
peering_conns = describe_peering_connections(params, client)
vpc_id = module.params.get('vpc_id')
peer_vpc_id = module.params.get('peer_vpc_id')
peer_owner_id = module.params.get('peer_owner_id', False)
peering_conns = describe_peering_connections(vpc_id, peer_vpc_id, client)
for peering_conn in peering_conns['VpcPeeringConnections']: for peering_conn in peering_conns['VpcPeeringConnections']:
if is_active(peering_conn): if is_active(peering_conn):
return (changed, peering_conn['VpcPeeringConnectionId']) return (changed, peering_conn['VpcPeeringConnectionId'])

Loading…
Cancel
Save