Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module elb_classic_lb_info does return noting unless names are given #754

Closed
1 task done
stefanhorning opened this issue Oct 11, 2021 · 2 comments · Fixed by #693
Closed
1 task done

Module elb_classic_lb_info does return noting unless names are given #754

stefanhorning opened this issue Oct 11, 2021 · 2 comments · Fixed by #693
Labels
bug This issue/PR relates to a bug needs_triage python3

Comments

@stefanhorning
Copy link
Contributor

stefanhorning commented Oct 11, 2021

Summary

When running the elb_classic_lb_info module it used to return all classic ELBs for the given account region, as the documentation still states for latest Ansible, see https://docs.ansible.com/ansible/latest/collections/community/aws/elb_classic_lb_info_module.html

List of ELB names to gather information about. Pass this option to gather information about a set of ELBs, otherwise, all ELBs are returned.

But this holds no longer true. If no name is provided nothing is returned. When looing at the code this is quite obvious why. As name defaults to an empty list and the list method iterates over the list of names, which does nothing when empty, see https://github.com/ansible-collections/community.aws/blob/main/plugins/modules/elb_classic_lb_info.py#L160

When passing in a name it will return info just fine.

Issue Type

Bug Report

Component Name

community.aws.elb_classic_lb_info

Ansible Version

$ ansible --version
ansible [core 2.11.5] 
  config file =./ansible.cfg
  configured module search path = ['./library', '~/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = ~/.local/lib/python3.9/site-packages/ansible
  ansible collection location = ~/.ansible/collections:/usr/share/ansible/collections
  executable location = ~/.local/bin/ansible
  python version = 3.9.5 (default, May 11 2021, 08:20:37) [GCC 10.3.0]
  jinja version = 3.0.1
  libyaml = True

Collection Versions

$ ansible-galaxy collection list
# ~/.ansible/collections/ansible_collections
Collection           Version
-------------------- -------
amazon.aws           1.5.0  
ansible.posix        1.3.0  
community.aws        1.5.0  
community.general    3.6.0  
community.postgresql 1.4.0  
community.rabbitmq   1.1.0  

Steps to Reproduce

    - name: Get ELBs information for classic loabalancers
      community.aws.elb_classic_lb_info:
      register: all_classic_elbs

    - name: Output ELB infos
      ansible.builtin.debug:
        var: all_classic_elbs

Expected Results

List of ELBs in all_classic_elbs.elbs

Actual Results

ok: [localhost] => {
    "all_classic_elbs": {
        "changed": false,
        "elbs": [],
        "failed": false
    }
}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@stefanhorning
Copy link
Contributor Author

Probably introduced in this commit 3d5ffdc

@ansibullbot ansibullbot added bug This issue/PR relates to a bug needs_triage python3 labels Oct 11, 2021
@stefanhorning
Copy link
Contributor Author

stefanhorning commented Oct 11, 2021

A task like

    - name: Get ELBs information for classic loabalancers
      community.aws.elb_classic_lb_info:
        names:
          - My-Existing-Loadbalancer
      register: all_classic_elbs

Returns results just fine. So either docs or code needs to be fixed.

@tremble tremble linked a pull request Oct 22, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug needs_triage python3
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants