theforeman / foreman-ansible-modules

Ansible modules for interacting with the Foreman API and various plugin APIs such as Katello
GNU General Public License v3.0
149 stars 166 forks source link

theforeman.foreman.resource_info Unknown action 'index'. Supported actions: disable, eligible, enable, status #1711

Open IncredibleRichie opened 9 months ago

IncredibleRichie commented 9 months ago
SUMMARY

theforeman.foreman.resource_info seems to use index were no index is allowed

ISSUE TYPE
ANSIBLE VERSION
ansible [core 2.15.3]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.11/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.5 (main, Oct 25 2023, 16:19:59) [GCC 8.5.0 20210514 (Red Hat 8.5.0-20)] (/usr/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
theforeman.foreman            4.0.0  
KATELLO/FOREMAN VERSION

foreman-3.9
STEPS TO REPRODUCE
- name: "Read all SCA with full details"
  theforeman.foreman.resource_info:
    <<: *auth_params
    resource: simple_content_access
    full_details: true
  register: result
- debug:
    var: result.resources
EXPECTED RESULTS

Info about the organizations SCA setting

ACTUAL RESULTS
TASK [or_smart_proxy_content : Read all SCA with full details] *********************************************
Thursday 22 February 2024  12:43:30 +0100 (0:00:00.075)       0:00:05.057 ***** 
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to list resource: KeyError: \"Unknown action 'index'. Supported actions: disable, eligible, enable, status\""}
evgeni commented 9 months ago

It's more that simple_content_access is not really a "resource", so it can't be indexed, or shown.

IncredibleRichie commented 9 months ago

Thanks.

If you run the module with an unsupported "resource" all supported "resources" are listed incl. simple_content_access, this lets me assume i can use it. It should then perhaps not be listed.

evgeni commented 9 months ago

I'd take a patch that filters those out that do not have an index action ;)