ec2_elb_facts: fix errors with no names input (#3381)

* None being passed around results in a Bad Time (tm)

* need to return the full set of elbs for an empty list

* logic is hard
This commit is contained in:
mattwwarren 2016-11-11 16:02:07 -05:00 committed by Matt Clay
parent 14fee8d5f7
commit 727e533bfc

View file

@ -203,16 +203,19 @@ class ElbInformation(object):
self.module.fail_json(msg = "%s: %s" % (err.error_code, err.error_message))
if all_elbs:
for existing_lb in all_elbs:
if existing_lb.name in self.names:
elb_array.append(self._get_elb_info(existing_lb))
return elb_array
if self.names:
for existing_lb in all_elbs:
if existing_lb.name in self.names:
elb_array.append(existing_lb)
else:
elb_array = all_elbs
return list(map(self._get_elb_info, elb_array))
def main():
argument_spec = ec2_argument_spec()
argument_spec.update(dict(
names={'default': None, 'type': 'list'}
names={'default': [], 'type': 'list'}
)
)
module = AnsibleModule(argument_spec=argument_spec)