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 2073535 - satellite-maintain packages check-update fails when there are no packages to be updated.
Summary: satellite-maintain packages check-update fails when there are no packages to ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Satellite Maintain
Version: 6.10.4
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: 6.14.0
Assignee: Sayan Das
QA Contact: Matyas Strelec
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-04-08 18:09 UTC by Rafael Cavalcanti
Modified: 2024-03-08 04:25 UTC (History)
11 users (show)

Fixed In Version: foreman-maintain-1.3.2
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2218656 (view as bug list)
Environment:
Last Closed: 2023-11-08 14:17:47 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 36369 0 Normal Closed Consider both 0 and 100 as valid exit codes for check-update yum action 2023-05-09 07:11:23 UTC
Github theforeman foreman_maintain pull 729 0 None Merged Fixes #36369 - Exit code 0 is a valid exit status 2023-05-09 07:11:22 UTC
Red Hat Issue Tracker SAT-17607 0 None None None 2023-05-08 17:49:51 UTC
Red Hat Product Errata RHSA-2023:6818 0 None None None 2023-11-08 14:17:59 UTC

Description Rafael Cavalcanti 2022-04-08 18:09:35 UTC
Description of problem:

The command 'satellite-maintain packages check-update' fails when there are no packages to be updated.
---
I, [2022-04-08 13:28:47-0400 #9496]  INFO -- : Running foreman-maintain command with arguments [["packages", "check-update"]]
I, [2022-04-08 13:28:47-0400 #9496]  INFO -- : === Scenario 'Check for available package updates' started ===
I, [2022-04-08 13:28:47-0400 #9496]  INFO -- : --- Execution step 'Check for available package updates' [packages-check-update] started ---
D, [2022-04-08 13:28:47-0400 #9496] DEBUG -- : Running command yum -y --disableplugin=foreman-protector check-update  with stdin nil
D, [2022-04-08 13:29:06-0400 #9496] DEBUG -- : output of the command:
 Loaded plugins: product-id, search-disabled-repos, subscription-manager
E, [2022-04-08 13:29:06-0400 #9496] ERROR -- : Failed executing yum -y --disableplugin=foreman-protector check-update , exit status 0:
 Loaded plugins: product-id, search-disabled-repos, subscription-manager (ForemanMaintain::Error::ExecutionError)
---

How reproducible:
100%

Steps to Reproduce:
1. Update all the rpms 

2. Run:
~~~
satellite-maintain packages check-update
~~~


Actual results:
~~~
satellite-maintain packages check-update
Running Check for available package updates
================================================================================
Check for available package updates:                                  [FAIL]
Failed executing yum -y --disableplugin=foreman-protector check-update , exit status 0:
 Loaded plugins: product-id, search-disabled-repos, subscription-manager
--------------------------------------------------------------------------------
Scenario [Check for available package updates] failed.

The following steps ended up in failing state:

  [packages-check-update]

Resolve the failed steps and rerun
the command. In case the failures are false positives,
use --whitelist="packages-check-update"
~~~

Expected results:
The tasks should not fail if there are no RPM's to be updated

Additional info:

The RC=100 is expected when 'yum update-check' finds a RPM. On the other hand, the RC=0 is expected when no RPM's are returned(Operation was successful). And the code should handle both RC's.

Comment 5 Sayan Das 2023-05-08 17:41:08 UTC
Created and Attaching:

Bug #36369: Consider both 0 and 100 as valid exit codes for check-update yum action - Foreman Maintain - Foreman
https://projects.theforeman.org/issues/36369

Fixes #36369 - Exit code 0 is a valid exit status by sayan3296 · Pull Request #729 · theforeman/foreman_maintain
https://github.com/theforeman/foreman_maintain/pull/729

Comment 6 Bryan Kearney 2023-05-08 20:02:32 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/36369 has been resolved.

Comment 7 Patrick Creech 2023-05-30 18:17:01 UTC
need this fix released in an upstream version of foreman_maintain

Comment 8 Matyas Strelec 2023-07-13 12:02:27 UTC
Verified that it works correctly on Satellite 6.14.0 snap 7.0.
Running `satellite-maintain packages check-update` after updating all the rpms the task finishes successfully with OK status.

# satellite-maintain packages check-update
Running Check for available package updates
================================================================================
Check for available package updates: 
Updating Subscription Management repositories.
Satellite 6.14 RHEL8                            329 kB/s | 3.0 kB     00:00    
Satellite Maintenance 6.14 RHEL8                437 kB/s | 2.6 kB     00:00    
Security: kernel-core-4.18.0-477.15.1.el8_8.x86_64 is an installed security update
Security: kernel-core-4.18.0-477.13.1.el8_8.x86_64 is the currently running version
                                                                      [OK]
--------------------------------------------------------------------------------

Comment 11 errata-xmlrpc 2023-11-08 14:17:47 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 (Important: Satellite 6.14 security and 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/RHSA-2023:6818

Comment 12 Red Hat Bugzilla 2024-03-08 04:25:08 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days


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