Handling dry run exception

pull/4420/head
Shawn Siefkas 2015-10-08 20:53:26 -05:00 committed by Matt Clay
parent 253d177dc3
commit 29d6313366
1 changed files with 5 additions and 5 deletions

View File

@ -496,13 +496,13 @@ def ensure_route_table_present(connection, module):
# If no route table returned then create new route table # If no route table returned then create new route table
if route_table is None: if route_table is None:
if module.check_mode: try:
route_table = connection.create_route_table(vpc_id, module.check_mode)
changed = True
except EC2ResponseError as e:
if e.error_code == 'DryRunOperation':
module.exit_json(changed=True) module.exit_json(changed=True)
try:
route_table = connection.create_route_table(vpc_id)
changed = True
except EC2ResponseError, e:
module.fail_json(msg=e.message) module.fail_json(msg=e.message)
if routes is not None: if routes is not None: