ansible/cloud
Ryan Brown 819fe45864 Fix failure when powering on/off EC2 instances by tag only. (#4767)
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.
2016-09-09 19:38:05 -04:00
..
amazon Fix failure when powering on/off EC2 instances by tag only. (#4767) 2016-09-09 19:38:05 -04:00
azure ssh_public_keys on Azure virtual machine is a list (#4350) 2016-08-25 15:08:54 -07:00
digital_ocean digital_ocean_tag name is a required field 2016-08-30 19:56:49 +01:00
docker Fix container labels expected vs actual comparison. 2016-08-27 08:00:13 -04:00
google Doc update 2016-07-26 18:05:37 +00:00
linode Py3 exclude list (#3698) 2016-05-19 15:34:59 -07:00
openstack description expanded for 112, AKA VRRP protocol) (#4645) 2016-09-07 12:30:03 -04:00
rackspace Fixing Rackspace compile time errors irt exception handling for Python 3 (#3849) 2016-06-03 06:39:58 -07:00
vmware Port vsphere_guest to py3/py2.4 syntax (#3721) 2016-05-23 09:36:24 -04:00
__init__.py package files 2014-09-26 11:05:47 -04:00