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:
parent
14fee8d5f7
commit
727e533bfc
1 changed files with 9 additions and 6 deletions
|
@ -203,16 +203,19 @@ class ElbInformation(object):
|
||||||
self.module.fail_json(msg = "%s: %s" % (err.error_code, err.error_message))
|
self.module.fail_json(msg = "%s: %s" % (err.error_code, err.error_message))
|
||||||
|
|
||||||
if all_elbs:
|
if all_elbs:
|
||||||
|
if self.names:
|
||||||
for existing_lb in all_elbs:
|
for existing_lb in all_elbs:
|
||||||
if existing_lb.name in self.names:
|
if existing_lb.name in self.names:
|
||||||
elb_array.append(self._get_elb_info(existing_lb))
|
elb_array.append(existing_lb)
|
||||||
|
else:
|
||||||
|
elb_array = all_elbs
|
||||||
|
|
||||||
return elb_array
|
return list(map(self._get_elb_info, elb_array))
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
names={'default': None, 'type': 'list'}
|
names={'default': [], 'type': 'list'}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
module = AnsibleModule(argument_spec=argument_spec)
|
module = AnsibleModule(argument_spec=argument_spec)
|
||||||
|
|
Loading…
Reference in a new issue