Uploaded image for project: 'Satellite'
  1. Satellite
  2. SAT-18713

satellite-maintain packages check-update fails when there are no packages to be updated.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 6.10.4
    • Satellite Maintain

      +++ This bug was initially created as a clone of Bug #2073535 +++

      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.

      — Additional comment from on 2022-04-08T18:12:02Z

      I believe this RC validation comes -> /usr/share/gems/gems/foreman_maintain-0.8.25/lib/foreman_maintain/package_manager/yum.rb:
      ~~~
      def check_update(packages: nil, with_status: false)
      yum_action('check-update', packages, :assumeyes => true, :valid_exit_statuses => [100],
      :with_status => with_status)
      end
      ~~~

      — Additional comment from on 2022-04-08T18:12:13Z

      I believe this RC validation comes -> /usr/share/gems/gems/foreman_maintain-0.8.25/lib/foreman_maintain/package_manager/yum.rb:
      ~~~
      def check_update(packages: nil, with_status: false)
      yum_action('check-update', packages, :assumeyes => true, :valid_exit_statuses => [100],
      :with_status => with_status)
      end
      ~~~

      — Additional comment from on 2022-04-11T16:56:40Z

      Similar behavior is seen on Sat6.9.8 too

      1. rpm -q satellite
        satellite-6.9.8-1.el7sat.noarch
      1. yum -y --disableplugin=foreman-protector check-update
        Loaded plugins: product-id, search-disabled-repos, subscription-manager
      1. echo $?
        0
      1. 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"

      — Additional comment from on 2022-09-22T10:35:32Z

      Hi Team,

      If we downgrade any package to its lower version and then if we execute the "satellite-maintain packages check-update" command, it works successfully.

      I have attached my ticket to this bugzilla.

      Thanks and Regards,
      Anand Jambhulkar

      — Additional comment from on 2023-05-08T17:41:08Z

      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

      — Additional comment from on 2023-05-08T20:02:32Z

      Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/36369 has been resolved.

      — Additional comment from on 2023-05-30T18:17:01Z

      need this fix released in an upstream version of foreman_maintain

            rhn-support-saydas Sayan Das
            jira-bugzilla-migration RH Bugzilla Integration
            Griffin Sullivan Griffin Sullivan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: