819fe45864
If you apply `wait=yes` and use `instance_tags` as your filter for stopping/starting EC2 instances, this stack trace happens: ``` An exception occurred during task execution. The full traceback is: │~ Traceback (most recent call last): │~ File "/tmp/ryansb/ansible_FwE8VR/ansible_module_ec2.py", line 1540, in <module> │~ main() │~ File "/tmp/ryansb/ansible_FwE8VR/ansible_module_ec2.py", line 1514, in main │~ (changed, instance_dict_array, new_instance_ids) = startstop_instances(module, ec2, instance_ids, state, instance_tags) │~ File "/tmp/ryansb/ansible_FwE8VR/ansible_module_ec2.py", line 1343, in startstop_instances │~ if len(matched_instances) < len(instance_ids): │~ TypeError: object of type 'NoneType' has no len() │~ │~ fatal: [localhost -> localhost]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_name": "ec2"}, "module_stderr": "Traceb│~ ack (most recent call last):\n File \"/tmp/ryansb/ansible_FwE8VR/ansible_module_ec2.py\", line 1540, in <module>\n main()\n File \"/tmp/│~ ryansb/ansible_FwE8VR/ansible_module_ec2.py\", line 1514, in main\n (changed, instance_dict_array, new_instance_ids) = startstop_instances│~ (module, ec2, instance_ids, state, instance_tags)\n File \"/tmp/ryansb/ansible_FwE8VR/ansible_module_ec2.py\", line 1343, in startstop_insta│~ nces\n if len(matched_instances) < len(instance_ids):\nTypeError: object of type 'NoneType' has no len()\n", "module_stdout": "", "msg": "│~ MODULE FAILURE", "parsed": false} ``` That's because the `instance_ids` variable is None if not supplied in the task. That means the instances that result from the instance_tags query aren't going to be included in the wait loop. To fix this, a list needs to be kept of instances with matching tags and that list needs to be added to `instance_ids` before the wait loop. |
||
---|---|---|
.. | ||
__init__.py | ||
_ec2_ami_search.py | ||
cloudformation.py | ||
ec2.py | ||
ec2_ami.py | ||
ec2_ami_find.py | ||
ec2_asg.py | ||
ec2_eip.py | ||
ec2_elb.py | ||
ec2_elb_lb.py | ||
ec2_facts.py | ||
ec2_group.py | ||
ec2_key.py | ||
ec2_lc.py | ||
ec2_metric_alarm.py | ||
ec2_scaling_policy.py | ||
ec2_snapshot.py | ||
ec2_tag.py | ||
ec2_vol.py | ||
ec2_vpc.py | ||
ec2_vpc_net.py | ||
elasticache.py | ||
elasticache_subnet_group.py | ||
iam.py | ||
iam_cert.py | ||
iam_policy.py | ||
rds.py | ||
rds_param_group.py | ||
rds_subnet_group.py | ||
route53.py | ||
s3.py |