Bug 2048913
Summary: | "foreman-maintain health check --label check-hotfix-installed" fails with error "undefined method `[]' for nil:NilClass" | ||
---|---|---|---|
Product: | Red Hat Satellite | Reporter: | sganar |
Component: | Satellite Maintain | Assignee: | Evgeni Golov <egolov> |
Status: | CLOSED ERRATA | QA Contact: | sganar |
Severity: | high | Docs Contact: | |
Priority: | unspecified | ||
Version: | 6.11.0 | CC: | ahumbe, apatel, aupadhye, egolov, gtalreja, kgaikwad, pcreech |
Target Milestone: | 6.11.0 | Keywords: | Regression, Triaged |
Target Release: | Unused | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | rubygem-foreman_maintain-1.0.3 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2022-07-05 14:32:43 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: | |||
Bug Depends On: | |||
Bug Blocks: | 1693733, 2052506 |
Description
sganar
2022-02-01 07:42:05 UTC
Thanks! Can you please try the following patch? diff --git definitions/checks/check_hotfix_installed.rb definitions/checks/check_hotfix_installed.rb index 3f025fc..1873540 100644 --- definitions/checks/check_hotfix_installed.rb +++ definitions/checks/check_hotfix_installed.rb @@ -46,7 +46,7 @@ class Checks::CheckHotfixInstalled < ForemanMaintain::Check def installed_packages packages = [] repoquery_cmd = execute!('which repoquery') - IO.popen([repoquery_cmd, '-a', '--installed', '--qf', '%{ui_from_repo} %{nvra}']) do |io| + IO.popen([repoquery_cmd, '-a', '--installed', '--qf', '%{ui_from_repo} %{name}-%{evr}.%{arch}']) do |io| io.each do |line| repo, pkg = line.chomp.split packages << pkg if /satellite|rhscl/ =~ repo[1..-1].downcase /usr/share/gems/gems/foreman_maintain-1.0.1/definitions/checks/check_hotfix_installed.rb is the file in question on your install Created redmine issue https://projects.theforeman.org/issues/34393 from this bug Thanks, after talking with Amit, this needs a bit more safeguarding: diff --git a/definitions/checks/check_hotfix_installed.rb b/definitions/checks/check_hotfix_installed.rb index 3f025fcd..8d9cb471 100644 --- a/definitions/checks/check_hotfix_installed.rb +++ b/definitions/checks/check_hotfix_installed.rb @@ -46,9 +46,11 @@ def modified_files(package) def installed_packages packages = [] repoquery_cmd = execute!('which repoquery') - IO.popen([repoquery_cmd, '-a', '--installed', '--qf', '%{ui_from_repo} %{nvra}']) do |io| + query_format = '%{ui_from_repo} %{name}-%{evr}.%{arch}' + IO.popen([repoquery_cmd, '-a', '--installed', '--qf', query_format]) do |io| io.each do |line| repo, pkg = line.chomp.split + next if repo.nil? || pkg.nil? packages << pkg if /satellite|rhscl/ =~ repo[1..-1].downcase end end (the next if part is new, the other is just differently formatted compared to the version I posted above) That worked! # foreman-maintain health check --label check-hotfix-installed Running preparation steps required to run the next scenarios ================================================================================ Check whether system has any non Red Hat repositories (e.g.: EPEL) enabled: - Checking repositories enabled on the system [OK] -------------------------------------------------------------------------------- Running ForemanMaintain::Scenario::FilteredScenario ================================================================================ Check to verify if any hotfix installed on system: - Checking for presence of hotfix(es). It may take some time to verify. [OK] -------------------------------------------------------------------------------- Awesome, thanks for the quick feedback! Upstream bug assigned to egolov Upstream bug assigned to egolov Verified. Tested on Satellite 7.0 Snap 9.0 RHEL 8.5 Steps followed: 1. Have a fresh Satellite on RHEL 8.5 2. Run foreman-maintain health check --label check-hotfix-installed Observation: health check passes without any error as expected. 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 (Moderate: Satellite 6.11 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-2022:5498 |