clarified error messages to actually give back ansible module option instead of internal boto field name
This commit is contained in:
parent
a913370687
commit
357d542bb3
1 changed files with 8 additions and 8 deletions
|
@ -1280,21 +1280,21 @@ def main():
|
||||||
else:
|
else:
|
||||||
module.fail_json(msg="region must be specified")
|
module.fail_json(msg="region must be specified")
|
||||||
|
|
||||||
tagged_instances = []
|
tagged_instances = []
|
||||||
|
|
||||||
state = module.params.get('state')
|
state = module.params['state']
|
||||||
|
|
||||||
if state == 'absent':
|
if state == 'absent':
|
||||||
instance_ids = module.params.get('instance_ids')
|
instance_ids = module.params['instance_ids']
|
||||||
if not isinstance(instance_ids, list):
|
if not instance_ids:
|
||||||
module.fail_json(msg='termination_list needs to be a list of instances to terminate')
|
module.fail_json(msg='instance_ids list is required for absent state')
|
||||||
|
|
||||||
(changed, instance_dict_array, new_instance_ids) = terminate_instances(module, ec2, instance_ids)
|
(changed, instance_dict_array, new_instance_ids) = terminate_instances(module, ec2, instance_ids)
|
||||||
|
|
||||||
elif state in ('running', 'stopped'):
|
elif state in ('running', 'stopped'):
|
||||||
instance_ids = module.params.get('instance_ids')
|
instance_ids = module.params['instance_ids']
|
||||||
if not isinstance(instance_ids, list):
|
if not instance_ids:
|
||||||
module.fail_json(msg='running list needs to be a list of instances to run: %s' % instance_ids)
|
module.fail_json(msg='instance_ids list is requried for %s state' % state)
|
||||||
|
|
||||||
(changed, instance_dict_array, new_instance_ids) = startstop_instances(module, ec2, instance_ids, state)
|
(changed, instance_dict_array, new_instance_ids) = startstop_instances(module, ec2, instance_ids, state)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue