Bug 2182861

Summary: Generating SCAP report fails with cannot load such file -- json (LoadError) error on RHEL 9
Product: Red Hat Satellite Reporter: Manu Sunil <msunil>
Component: SCAP PluginAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED MIGRATED QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.12.0CC: aruzicka, mhulan, nalfassi
Target Milestone: UnspecifiedKeywords: MigratedToJIRA, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-06-06 16:11:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Manu Sunil 2023-03-29 19:39:10 UTC
Description of problem:

- Generating SCAP report fails with the following error on RHEL 9.

  ~~~
  cannot load such file -- json (LoadError)
  ~~~

Version-Release number of selected component (if applicable):

- RHEL 9

How reproducible:

- In scenarios where rubygem-json is not installed. 

Steps to Reproduce:

1. Exclude the package rubygem-json from the repository. A CV filter can be used if the client is registered to a Satellite

2. Install the package `rubygem-foreman_scap_client`

3. Run `/usr/bin/foreman_scap_client`

Actual results:

- foreman_scap_client fails with the following error.

  ~~~
  # /usr/bin/foreman_scap_client 1
  <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- json (LoadError)
      from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require'
      from /usr/share/gems/gems/foreman_scap_client-0.5.0/lib/foreman_scap_client/base_client.rb:9:in `<top (required)>'
      from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require'
      from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require'
      from /usr/share/gems/gems/foreman_scap_client-0.5.0/lib/foreman_scap_client/client.rb:1:in `<top (required)>'
      from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require'
      from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require'
      from /usr/share/gems/gems/foreman_scap_client-0.5.0/lib/foreman_scap_client.rb:2:in `<top (required)>'
      from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require'
      from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require'
      from /usr/share/gems/gems/foreman_scap_client-0.5.0/bin/foreman_scap_client:3:in `<top (required)>'
      from /usr/bin/foreman_scap_client:23:in `load'
      from /usr/bin/foreman_scap_client:23:in `<main>'
  ~~~

Expected results:

- Installation of rubygem-foreman_scap_client should fail if rubygem-json is not available for some reason. 

Additional info:

- There seems to be some issue with the dependencies.

- rubygem-foreman_scap_client can be installed with or without the rubygem-json package. See the transactions below. On the second transaction, rubygem-json package was filtered using CV filter.

  ~~~
  # dnf install rubygem-foreman_scap_client        

  Dependencies resolved.
  ==================================================================================================================================================================================
   Package                                        Architecture              Version                              Repository                                                    Size
  ==================================================================================================================================================================================
  Installing:
   rubygem-foreman_scap_client                    noarch                    0.5.0-1.el9sat                       satellite-client-6-for-rhel-9-x86_64-rpms                     25 k
  Installing dependencies:
   bzip2                                          x86_64                    1.0.8-8.el9                          rhel-9-for-x86_64-baseos-rpms                                 60 k
   libtool-ltdl                                   x86_64                    2.4.6-45.el9                         rhel-9-for-x86_64-appstream-rpms                              39 k
   libxslt                                        x86_64                    1.1.34-9.el9                         rhel-9-for-x86_64-appstream-rpms                             247 k
   openscap                                       x86_64                    1:1.3.6-4.el9                        rhel-9-for-x86_64-appstream-rpms                             2.0 M
   openscap-scanner                               x86_64                    1:1.3.6-4.el9                        rhel-9-for-x86_64-appstream-rpms                              61 k
   ruby                                           x86_64                    3.0.4-160.el9_0                      rhel-9-for-x86_64-appstream-rpms                              45 k
   ruby-libs                                      x86_64                    3.0.4-160.el9_0                      rhel-9-for-x86_64-appstream-rpms                             3.3 M
   rubygem-json                                   x86_64                    2.5.1-160.el9_0                      rhel-9-for-x86_64-appstream-rpms                              63 k
   rubygem-psych                                  x86_64                    3.3.2-160.el9_0                      rhel-9-for-x86_64-appstream-rpms                              64 k
   rubygems                                       noarch                    3.2.33-160.el9_0                     rhel-9-for-x86_64-appstream-rpms                             310 k
   xmlsec1                                        x86_64                    1.2.29-9.el9                         rhel-9-for-x86_64-appstream-rpms                             193 k
   xmlsec1-openssl                                x86_64                    1.2.29-9.el9                         rhel-9-for-x86_64-appstream-rpms                              93 k
  Installing weak dependencies:
   ruby-default-gems                              noarch                    3.0.4-160.el9_0                      rhel-9-for-x86_64-appstream-rpms                              50 k
   rubygem-bigdecimal                             x86_64                    3.0.0-160.el9_0                      rhel-9-for-x86_64-appstream-rpms                              60 k
   rubygem-bundler                                noarch                    2.2.33-160.el9_0                     rhel-9-for-x86_64-appstream-rpms                             460 k
   rubygem-io-console                             x86_64                    0.5.7-160.el9_0                      rhel-9-for-x86_64-appstream-rpms                              30 k
   rubygem-rdoc                                   noarch                    6.3.3-160.el9_0                      rhel-9-for-x86_64-appstream-rpms                             444 k
  
  Transaction Summary
  ==================================================================================================================================================================================
  Install  18 Packages
  ~~~


  ~~~
  # dnf install rubygem-foreman_scap_client
  
  Dependencies resolved.
  ==================================================================================================================================================================================
   Package                                        Architecture              Version                              Repository                                                    Size
  ==================================================================================================================================================================================
  Installing:
   rubygem-foreman_scap_client                    noarch                    0.5.0-1.el9sat                       satellite-client-6-for-rhel-9-x86_64-rpms                     25 k
  Installing dependencies:
   bzip2                                          x86_64                    1.0.8-8.el9                          rhel-9-for-x86_64-baseos-rpms                                 60 k
   libtool-ltdl                                   x86_64                    2.4.6-45.el9                         rhel-9-for-x86_64-appstream-rpms                              39 k
   libxslt                                        x86_64                    1.1.34-9.el9                         rhel-9-for-x86_64-appstream-rpms                             247 k
   openscap                                       x86_64                    1:1.3.6-4.el9                        rhel-9-for-x86_64-appstream-rpms                             2.0 M
   openscap-scanner                               x86_64                    1:1.3.6-4.el9                        rhel-9-for-x86_64-appstream-rpms                              61 k
   ruby                                           x86_64                    3.0.4-160.el9_0                      rhel-9-for-x86_64-appstream-rpms                              45 k
   ruby-libs                                      x86_64                    3.0.4-160.el9_0                      rhel-9-for-x86_64-appstream-rpms                             3.3 M
   rubygem-psych                                  x86_64                    3.3.2-160.el9_0                      rhel-9-for-x86_64-appstream-rpms                              64 k
   rubygems                                       noarch                    3.2.33-160.el9_0                     rhel-9-for-x86_64-appstream-rpms                             310 k
   xmlsec1                                        x86_64                    1.2.29-9.el9                         rhel-9-for-x86_64-appstream-rpms                             193 k
   xmlsec1-openssl                                x86_64                    1.2.29-9.el9                         rhel-9-for-x86_64-appstream-rpms                              93 k
  Installing weak dependencies:
   ruby-default-gems                              noarch                    3.0.4-160.el9_0                      rhel-9-for-x86_64-appstream-rpms                              50 k
   rubygem-bigdecimal                             x86_64                    3.0.0-160.el9_0                      rhel-9-for-x86_64-appstream-rpms                              60 k
   rubygem-bundler                                noarch                    2.2.33-160.el9_0                     rhel-9-for-x86_64-appstream-rpms                             460 k
   rubygem-io-console                             x86_64                    0.5.7-160.el9_0                      rhel-9-for-x86_64-appstream-rpms                              30 k
  
  Transaction Summary
  ==================================================================================================================================================================================
  Install  16 Packages
  ~~~

- rubygem-foreman_scap_client installation on RHEL 7 on the other hand fails if rubygem-json is not present.

  ~~~
  # yum install rubygem-foreman_scap_client
  Loaded plugins: product-id, search-disabled-repos, subscription-manager
  Resolving Dependencies
  --> Running transaction check
  ---> Package rubygem-foreman_scap_client.noarch 0:0.5.0-1.el7sat will be installed
  --> Processing Dependency: /usr/bin/ruby for package: rubygem-foreman_scap_client-0.5.0-1.el7sat.noarch
  --> Processing Dependency: bzip2 for package: rubygem-foreman_scap_client-0.5.0-1.el7sat.noarch
  --> Processing Dependency: openscap-scanner for package: rubygem-foreman_scap_client-0.5.0-1.el7sat.noarch
  --> Processing Dependency: ruby(release) for package: rubygem-foreman_scap_client-0.5.0-1.el7sat.noarch
  --> Processing Dependency: ruby(rubygems) for package: rubygem-foreman_scap_client-0.5.0-1.el7sat.noarch
  --> Running transaction check
  ---> Package bzip2.x86_64 0:1.0.6-13.el7 will be installed
  ---> Package openscap-scanner.x86_64 0:1.2.17-15.el7_9 will be installed
  --> Processing Dependency: openscap(x86-64) = 1.2.17-15.el7_9 for package: openscap-scanner-1.2.17-15.el7_9.x86_64
  --> Processing Dependency: libopenscap.so.8()(64bit) for package: openscap-scanner-1.2.17-15.el7_9.x86_64
  ---> Package ruby.x86_64 0:2.0.0.648-39.el7_9 will be installed
  --> Processing Dependency: rubygem(bigdecimal) >= 1.2.0 for package: ruby-2.0.0.648-39.el7_9.x86_64
  ---> Package ruby-libs.x86_64 0:2.0.0.648-39.el7_9 will be installed
  ---> Package rubygems.noarch 0:2.0.14.1-39.el7_9 will be installed
  --> Processing Dependency: rubygem(io-console) >= 0.4.2 for package: rubygems-2.0.14.1-39.el7_9.noarch
  --> Processing Dependency: rubygem(psych) >= 2.0.0 for package: rubygems-2.0.14.1-39.el7_9.noarch
  --> Processing Dependency: rubygem(rdoc) >= 4.0.0 for package: rubygems-2.0.14.1-39.el7_9.noarch
  --> Running transaction check
  ---> Package openscap.x86_64 0:1.2.17-15.el7_9 will be installed
  ---> Package rubygem-bigdecimal.x86_64 0:1.2.0-39.el7_9 will be installed
  ---> Package rubygem-io-console.x86_64 0:0.4.2-39.el7_9 will be installed
  ---> Package rubygem-psych.x86_64 0:2.0.0-39.el7_9 will be installed
  ---> Package rubygem-rdoc.noarch 0:4.0.0-39.el7_9 will be installed
  --> Processing Dependency: ruby(irb) = 2.0.0.648 for package: rubygem-rdoc-4.0.0-39.el7_9.noarch
  --> Processing Dependency: rubygem(json) >= 1.7.7 for package: rubygem-rdoc-4.0.0-39.el7_9.noarch
  --> Running transaction check
  ---> Package ruby-irb.noarch 0:2.0.0.648-39.el7_9 will be installed
  ---> Package rubygem-rdoc.noarch 0:4.0.0-39.el7_9 will be installed
  --> Processing Dependency: rubygem(json) >= 1.7.7 for package: rubygem-rdoc-4.0.0-39.el7_9.noarch
  --> Finished Dependency Resolution
  Error: Package: rubygem-rdoc-4.0.0-39.el7_9.noarch (rhel-7-server-rpms)
             Requires: rubygem(json) >= 1.7.7
   You could try using --skip-broken to work around the problem
   You could try running: rpm -Va --nofiles --nodigest
  ~~~

Comment 1 Eric Helms 2024-06-06 16:11:50 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "SAT-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.