Make sure to catch if no gateways exist
This commit is contained in:
parent
4e8e38f631
commit
8af1063785
1 changed files with 1 additions and 2 deletions
|
@ -342,6 +342,7 @@ def get_nat_gateways(client, subnet_id=None, nat_gateway_id=None,
|
||||||
params = dict()
|
params = dict()
|
||||||
err_msg = ""
|
err_msg = ""
|
||||||
gateways_retrieved = False
|
gateways_retrieved = False
|
||||||
|
existing_gateways = list()
|
||||||
if not states:
|
if not states:
|
||||||
states = ['available', 'pending']
|
states = ['available', 'pending']
|
||||||
if nat_gateway_id:
|
if nat_gateway_id:
|
||||||
|
@ -361,14 +362,12 @@ def get_nat_gateways(client, subnet_id=None, nat_gateway_id=None,
|
||||||
try:
|
try:
|
||||||
if not check_mode:
|
if not check_mode:
|
||||||
gateways = client.describe_nat_gateways(**params)['NatGateways']
|
gateways = client.describe_nat_gateways(**params)['NatGateways']
|
||||||
existing_gateways = list()
|
|
||||||
if gateways:
|
if gateways:
|
||||||
for gw in gateways:
|
for gw in gateways:
|
||||||
existing_gateways.append(convert_to_lower(gw))
|
existing_gateways.append(convert_to_lower(gw))
|
||||||
gateways_retrieved = True
|
gateways_retrieved = True
|
||||||
else:
|
else:
|
||||||
gateways_retrieved = True
|
gateways_retrieved = True
|
||||||
existing_gateways = []
|
|
||||||
if nat_gateway_id:
|
if nat_gateway_id:
|
||||||
if DRY_RUN_GATEWAYS[0]['nat_gateway_id'] == nat_gateway_id:
|
if DRY_RUN_GATEWAYS[0]['nat_gateway_id'] == nat_gateway_id:
|
||||||
existing_gateways = DRY_RUN_GATEWAYS
|
existing_gateways = DRY_RUN_GATEWAYS
|
||||||
|
|
Loading…
Reference in a new issue