Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
Continuation of https://bugzilla.redhat.com/show_bug.cgi?id=2213777.
That BZ fixed unsetting products' GPG keys. Now, there is an issue with unsetting repositories' GPG keys.
The following error occurs:
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to lookup scope ['organization'] while searching for content_credentials."}
Version-Release number of selected component (if applicable):
Satellite 6.14.0
How reproducible:
100%
Steps to Reproduce:
Run the following playbook:
[root@sat-6-14-qa-rhel8 ~]# cat playbook-bz-2213777.yml
- name: issue 36497
hosts: localhost
become: no
gather_facts: no
tasks:
- name: "create key"
redhat.satellite.content_credential:
username: "admin"
password: "changeme"
server_url: "https://sat-6-14-qa-rhel8.example.com/"
validate_certs: false
name: "RPM-GPG-KEY-my-repo"
content_type: gpg_key
organization: "Default Organization"
content: "test"
- name: product with key
redhat.satellite.product:
username: "admin"
password: "changeme"
server_url: "https://sat-6-14-qa-rhel8.example.com/"
validate_certs: false
name: "prod"
organization: "Default Organization"
gpg_key: "RPM-GPG-KEY-my-repo"
- name: product without key
redhat.satellite.product:
username: "admin"
password: "changeme"
server_url: "https://sat-6-14-qa-rhel8.example.com/"
validate_certs: false
name: "prod"
organization: "Default Organization"
gpg_key: ""
- name: repo with key
redhat.satellite.repository:
username: "admin"
password: "changeme"
server_url: "https://sat-6-14-qa-rhel8.example.com/"
validate_certs: false
name: "repo"
organization: "Default Organization"
product: "prod"
content_type: "yum"
gpg_key: "RPM-GPG-KEY-my-repo"
- name: repo without key
redhat.satellite.repository:
username: "admin"
password: "changeme"
server_url: "https://sat-6-14-qa-rhel8.example.com/"
validate_certs: false
name: "repo"
organization: "Default Organization"
product: "prod"
content_type: "yum"
gpg_key: ""
Actual results:
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to lookup scope ['organization'] while searching for content_credentials."}
Expected results:
GPG key on the repository at the end is unset.
Additional info:
Copy-pasted from https://bugzilla.redhat.com/show_bug.cgi?id=2213777:
The issue I found on repositories appears to be in foreman ansible modules itself:
831 -> def lookup_entity(self, key, params=None):
832 if key not in self.foreman_params:
833 return None
834
835 entity_spec = self.foreman_spec[key]
836 if _is_resolved(entity_spec, self.foreman_params[key]):
(Epdb) key
'organization'
(Epdb) self.foreman_params['organization']
*** KeyError: 'organization'
(Epdb) self.foreman_params['entity']['organization']
{'name': 'Default Organization', 'label': 'Default_Organization', 'id': 1}
The organization is in the body of the request from Katello:
2023-07-19T20:41:07 [D|app|42104fc2] With body: {"relative_path":"Default_Organization/Library/custom/prod/repo","promoted":false,"content_view_version_id":1,"library_instance_id":null,"last_contents_changed":"2023-07-19 19:08:38 UTC","organization_id":1,"organization":{"name":"Default Organization","label":"Default_Organization","id":1},...
It looks like the foreman ansible modules might be filtering out the organization somehow. The organization is in self.foreman_params['entity'] but not self.foreman_params, which is causing it to not be found.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory (Important: Satellite 6.15.0 release), and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHSA-2024:2010