|
|
@ -919,12 +919,13 @@ def create_instances(module, ec2, override_count=None):
|
|
|
|
# The instances returned through ec2.run_instances above can be in
|
|
|
|
# The instances returned through ec2.run_instances above can be in
|
|
|
|
# terminated state due to idempotency. See commit 7f11c3d for a complete
|
|
|
|
# terminated state due to idempotency. See commit 7f11c3d for a complete
|
|
|
|
# explanation.
|
|
|
|
# explanation.
|
|
|
|
terminated_instances = [ str(instance.id) for instance in res.instances
|
|
|
|
terminated_instances = [
|
|
|
|
if instance.state == 'terminated' ]
|
|
|
|
str(instance.id) for instance in res.instances if instance.state == 'terminated'
|
|
|
|
|
|
|
|
]
|
|
|
|
if terminated_instances:
|
|
|
|
if terminated_instances:
|
|
|
|
module.fail_json(msg = "Instances with id(s) %s " % terminated_instances +
|
|
|
|
module.fail_json(msg = "Instances with id(s) %s " % terminated_instances +
|
|
|
|
"were created previously but have since been terminated - " +
|
|
|
|
"were created previously but have since been terminated - " +
|
|
|
|
"use a (possibly different) 'instanceid' parameter")
|
|
|
|
"use a (possibly different) 'instanceid' parameter")
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
if private_ip:
|
|
|
|
if private_ip:
|
|
|
|