ansible/cloud/amazon
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
..
__init__.py added __init__.py to new cloud subcategories so builds work again 2014-11-05 11:07:19 -05:00
_ec2_ami_search.py Fix for #16518 - added missing regions 2016-06-30 17:53:15 +05:30
cloudformation.py Properly support tag updates on CloudFormation stack-update actions (#3638) 2016-09-07 16:16:32 -04:00
ec2.py Fix failure when powering on/off EC2 instances by tag only. (#4767) 2016-09-09 19:38:05 -04:00
ec2_ami.py added missing colons to documentation (#3913) 2016-06-10 09:44:57 -04:00
ec2_ami_find.py Merge pull request #3077 from jjshoe/devel 2016-03-21 11:23:23 -07:00
ec2_asg.py Fix #2526 (#2527) 2016-08-02 13:37:01 -07:00
ec2_eip.py Fixes #3144 (#4305) 2016-08-30 15:16:42 +02:00
ec2_elb.py Fixing error exception handling for python3. Does not need to be compa… (#3840) 2016-06-02 12:56:48 -07:00
ec2_elb_lb.py Merge pull request #4275 from shaunbrady/ec2_elb_lb_respect_vpc 2016-08-17 14:06:25 -04:00
ec2_facts.py Fix for #16518 - added missing regions 2016-06-30 17:53:15 +05:30
ec2_group.py Fix for validate rule. Ensure rule is a dict. (#4640) 2016-09-02 15:09:58 -04:00
ec2_key.py Fixing error exception handling for python3. Does not need to be compa… (#3840) 2016-06-02 12:56:48 -07:00
ec2_lc.py Improve documentation on security_groups-option 2016-07-12 15:52:58 +03:00
ec2_metric_alarm.py Fixing error exception handling for python3. Does not need to be compa… (#3840) 2016-06-02 12:56:48 -07:00
ec2_scaling_policy.py Fixing error exception handling for python3. Does not need to be compa… (#3840) 2016-06-02 12:56:48 -07:00
ec2_snapshot.py Fixing error exception handling for python3. Does not need to be compa… (#3840) 2016-06-02 12:56:48 -07:00
ec2_tag.py Add more example on how to use module ec2_tags to list tags on an ins… (#3530) 2016-04-26 10:51:36 -04:00
ec2_vol.py Fixing error exception handling for python3. Does not need to be compa… (#3840) 2016-06-02 12:56:48 -07:00
ec2_vpc.py Getting rid of a None type error when no resource tags are defined. (#4638) 2016-09-02 11:54:27 -07:00
ec2_vpc_net.py Check mode fixes for ec2_vpc_net module (#2179) 2016-08-02 13:39:27 -07:00
elasticache.py Fixing error exception handling for python3. Does not need to be compa… (#3840) 2016-06-02 12:56:48 -07:00
elasticache_subnet_group.py Fixing error exception handling for python3. Does not need to be compa… (#3840) 2016-06-02 12:56:48 -07:00
iam.py Merge pull request #3863 from ryansb/iam-pass-module 2016-07-14 13:34:46 -04:00
iam_cert.py Enforce boolean type for dup_ok 2016-07-21 15:02:49 -04:00
iam_policy.py Remove spurious changed state on iam_policy module (#4381) 2016-08-30 10:24:00 -04:00
rds.py Add default port for aurora (#4102) 2016-07-11 01:20:12 +02:00
rds_param_group.py Add support for PostgreSQL 9.5 in rds_param_group (fix for #3846) 2016-06-02 18:07:00 -04:00
rds_subnet_group.py Fixing error exception handling for python3. Does not need to be compa… (#3840) 2016-06-02 12:56:48 -07:00
route53.py Add an example to delete Route53 alias record set (#3834) 2016-06-06 22:51:25 +02:00
s3.py Add s3_url requirement in doc when rgw support is enabled in s3.py 2016-06-21 10:53:47 +02:00