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
146 stars 163 forks source link

Local Product Subscription IDs are not Found Unless State=Present #1258

Open jamesmarshall24 opened 3 years ago

jamesmarshall24 commented 3 years ago
SUMMARY

Local products return "Found no results while searching for subscriptions with id=redact" when state is not explicitly provided as "present" for activation_key module

ISSUE TYPE
ANSIBLE VERSION
ansible-playbook 2.9.18
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/var/lib/awx/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.5 (default, Aug 13 2020, 02:51:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
COLLECTION VERSION
v2.1.1
KATELLO/FOREMAN VERSION
katello-3.14.0-6.el7sat.noarch
STEPS TO REPRODUCE
- name: "Update activaton key"
  redhat.satellite.activation_key:
      username: "api"
      password: "redact"
      server_url: "redact"
      name: "RHELredact"
      organization: "{{ ORG }}"
      lifecycle_environment: "redact"
      content_view: "redact"
      host_collections: "redact"
      content_overrides: "{{ lookup(redact) }}"
      subscriptions: "{{ lookup(redact) }}"
      auto_attach: False
      release_version: 7Server
      unlimited_hosts: yes
      service_level: Premium
      validate_certs: no
  with_nested:
      - redact
  register: update_activation_key
EXPECTED RESULTS

Pool ID found for local products

ACTUAL RESULTS
"msg": "Found no results while searching for subscriptions with id="redact"

Listing the subscriptions show the subscription ID.

Adding "state: present" resolves the issue although that should be the default value.

evgeni commented 3 years ago

It's a bit hard to debug if all your data is "redact"

Can you please send the real playbook and the real output to evgeni@redhat.com? thanks.

jamesmarshall24 commented 3 years ago

@evgeni sent

evgeni commented 3 years ago

I got the data, but by the love of god don't see how this should fail in that environment :(

Could you get me the output of the following playbook please?

      - name: get sub info
        redhat.satellite.subscription_info:
          username: "{{ foreman_username }}"
          password: "{{ foreman_password }}"
          server_url: "{{ foreman_url }}"
          validate_certs: "{{ foreman_validate_certs }}"
          organization: "{{ foreman_organization }}"
        register: subs

      - debug:
          var: subs

(fill out the vars as needed, obviously ;))