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.
Bug 2090390 - undefined method `find' for nil:NilClass when importing content that has gpg_keys associated to it
Summary: undefined method `find' for nil:NilClass when importing content that has gpg_...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Inter Satellite Sync
Version: 6.10.5
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: 6.11.1
Assignee: satellite6-bugs
QA Contact: Radek Mynar
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-05-25 16:16 UTC by Joniel Pasqualetto
Modified: 2023-11-06 08:07 UTC (History)
10 users (show)

Fixed In Version: tfm-rubygem-katello-4.3.0.43-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2093407 2103110 (view as bug list)
Environment:
Last Closed: 2022-07-27 17:27:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Hotfix RPM for Satellite 6.11.0 on RHEL7 (10.56 MB, application/x-rpm)
2022-07-25 19:21 UTC, wclark
no flags Details
Hotfix RPM for Satellite 6.11.0 on RHEL8 (10.50 MB, application/x-rpm)
2022-07-25 19:23 UTC, wclark
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 34966 0 High Closed undefined method `find' for nil:NilClass when importing content that has gpg_keys associated to it 2022-06-07 15:06:04 UTC
Github Katello katello pull 10130 0 None Merged Fixes #34966 2022-06-02 13:22:34 UTC
Red Hat Issue Tracker SAT-10611 0 None None None 2023-05-11 09:35:18 UTC
Red Hat Knowledge Base (Solution) 6960885 0 None None None 2022-05-26 15:24:34 UTC
Red Hat Product Errata RHBA-2022:5742 0 None None None 2022-07-27 17:27:19 UTC

Description Joniel Pasqualetto 2022-05-25 16:16:00 UTC
Description of problem:

Fail to parse the the metadata when importing products/repositories that have a GPG key associated. Import task fails almost immediately with the following trace back:

~~~
2022-05-25T10:22:02 [E|app|0a12262c] NoMethodError: undefined method `find' for nil:NilClass
 0a12262c | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.56/app/services/katello/pulp3/content_view_version/metadata_map.rb:108:in `gpg_key_for_product'
 0a12262c | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.56/app/services/katello/pulp3/content_view_version/metadata_map.rb:63:in `block in parse_products'
 0a12262c | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.56/app/services/katello/pulp3/content_view_version/metadata_map.rb:57:in `map'
 0a12262c | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.56/app/services/katello/pulp3/content_view_version/metadata_map.rb:57:in `parse_products'
 0a12262c | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.56/app/services/katello/pulp3/content_view_version/metadata_map.rb:27:in `initialize'
 0a12262c | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.56/app/lib/actions/katello/content_view_version/import.rb:6:in `new'
 0a12262c | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.56/app/lib/actions/katello/content_view_version/import.rb:6:in `plan'
 0a12262c | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.9/lib/dynflow/action.rb:515:in `block (3 levels) in execute_plan'
~~~

Version-Release number of selected component (if applicable):
Satellite 6.10.5 (katello-4.1.1.56)

How reproducible:
Always

Steps to Reproduce:
1. Create a custom product/repository and assign a GPG key to it
2. Create a CV including the repository created on step 1
3. Create a complete export of the CV created on step 2
4. Try importing the content

Actual results:

Fail to process the metadata and import doesn't work:

~~~
# hammer content-import version --path /var/lib/pulp/imports/Zabbix/1.0/2022-05-25T11-20-12-04-00/ --organization-id 4
Could not import the archive.:
  undefined method `find' for nil:NilClass
~~~


Expected results:

Import to start

Additional info:

Issue happens here (file /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.56/app/services/katello/pulp3/content_view_version/metadata_map.rb):

~~~
        def initialize(metadata:)
          @toc = metadata[:toc]
          @products = parse_products(metadata[:products]) if metadata[:products]
          @repositories = parse_repositories(metadata[:repositories]) if metadata[:repositories]
          @content_view = parse_content_view(metadata[:content_view]) if metadata[:content_view]
          @content_view_version = parse_content_view_version(metadata[:content_view_version]) if metadata[:content_view_version]
          @from_content_view_version = parse_content_view_version(metadata[:from_content_view_version]) if metadata[:from_content_view_version]
          @gpg_keys = parse_gpg_keys(metadata[:gpg_keys]) if metadata[:gpg_keys]
        end
~~~

When initializing the variable @products, the parser tries to access the variable @gpg_keys, that has not been initialized yet at that point. Simply changing the order of the initialization of those variables allows the import to happen.

Comment 3 Bryan Kearney 2022-06-02 00:04:39 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/34966 has been resolved.

Comment 4 Radek Mynar 2022-07-15 13:34:35 UTC
Importing library and contentview containing repository with associated GPG key works properly.

VERIFIED with Satellite 6.11.1 SNAP1 @RHEL8.6 (rubygem-katello-4.3.0.44-1.el8sat.noarch)

Comment 6 wclark 2022-07-25 19:21:24 UTC
Created attachment 1899240 [details]
Hotfix RPM for Satellite 6.11.0 on RHEL7

INSTALL INSTRUCTIONS:

1. Take a complete backup or snapshot of Satellite 6.11.0 server

2. Download the hotfix RPM for Satellite 6.11.0 on RHEL7 attached to this BZ and copy it to Satellite server

3. # yum install ./tfm-rubygem-katello-4.3.0.42-2.HOTFIXRHBZ2090390.el7sat.noarch.rpm --disableplugin=foreman-protector

4. # satellite-maintain service restart

Comment 7 wclark 2022-07-25 19:23:08 UTC
Created attachment 1899241 [details]
Hotfix RPM for Satellite 6.11.0 on RHEL8

INSTALL INSTRUCTIONS:

1. Take a complete backup or snapshot of Satellite 6.11.0 server

2. Download the hotfix RPM for Satellite 6.11.0 on RHEL8 attached to this BZ and copy it to Satellite server

3. # dnf install ./rubygem-katello-4.3.0.42-2.HOTFIXRHBZ2090390.el8sat.noarch.rpm --disableplugin=foreman-protector

4. # satellite-maintain service restart

Comment 11 errata-xmlrpc 2022-07-27 17:27:09 UTC
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 (Satellite 6.11.1 Async Bug Fix Update), 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/RHBA-2022:5742


Note You need to log in before you can comment on or make changes to this bug.