Handling dry run exception

This commit is contained in:
Shawn Siefkas 2015-10-08 20:53:26 -05:00
parent 6186da08ef
commit dbdd2475e6

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:
module.exit_json(changed=True)
try: try:
route_table = connection.create_route_table(vpc_id) route_table = connection.create_route_table(vpc_id, module.check_mode)
changed = True changed = True
except EC2ResponseError, e: except EC2ResponseError as e:
if e.error_code == 'DryRunOperation':
module.exit_json(changed=True)
module.fail_json(msg=e.message) module.fail_json(msg=e.message)
if routes is not None: if routes is not None: