Add region to doc and handle missing region parameter
This commit is contained in:
parent
f35ab5faca
commit
5e61f0882b
1 changed files with 8 additions and 5 deletions
|
@ -259,7 +259,6 @@ def main():
|
||||||
insufficient_data_actions=dict(type='list'),
|
insufficient_data_actions=dict(type='list'),
|
||||||
ok_actions=dict(type='list'),
|
ok_actions=dict(type='list'),
|
||||||
state=dict(default='present', choices=['present', 'absent']),
|
state=dict(default='present', choices=['present', 'absent']),
|
||||||
region=dict(aliases=['aws_region', 'ec2_region']),
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -271,10 +270,14 @@ def main():
|
||||||
state = module.params.get('state')
|
state = module.params.get('state')
|
||||||
|
|
||||||
region, ec2_url, aws_connect_params = get_aws_connection_info(module)
|
region, ec2_url, aws_connect_params = get_aws_connection_info(module)
|
||||||
try:
|
|
||||||
connection = connect_to_aws(boto.ec2.cloudwatch, region, **aws_connect_params)
|
if region:
|
||||||
except (boto.exception.NoAuthHandlerFound, StandardError), e:
|
try:
|
||||||
module.fail_json(msg=str(e))
|
connection = connect_to_aws(boto.ec2.cloudwatch, region, **aws_connect_params)
|
||||||
|
except (boto.exception.NoAuthHandlerFound, StandardError), e:
|
||||||
|
module.fail_json(msg=str(e))
|
||||||
|
else:
|
||||||
|
module.fail_json(msg="region must be specified")
|
||||||
|
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
create_metric_alarm(connection, module)
|
create_metric_alarm(connection, module)
|
||||||
|
|
Loading…
Reference in a new issue