RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 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 "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". 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 "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-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 1807887 - "yum check-update" doesn't return exit code of 1 even if the metadata is expired and network is disconnected.
Summary: "yum check-update" doesn't return exit code of 1 even if the metadata is expi...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: yum
Version: 7.7
Hardware: x86_64
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Packaging Maintenance Team
QA Contact: swm-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-02-27 12:30 UTC by Ryo Hayakawa
Modified: 2020-04-29 07:37 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-29 07:37:14 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1822576 0 low CLOSED "openstack overcloud update run" doesn't return error, even if not able to connect to yum repository and yum metadata ca... 2021-02-22 00:41:40 UTC

Internal Links: 1822576

Description Ryo Hayakawa 2020-02-27 12:30:45 UTC
Description of problem:

  "yum check-update" returns exit code of 0 or 100, even if the metadata is expired and network is disconnected.
  I think it should return 1 in this case because part of check-update in YUM(8) says like following:

    Returns exit value of 100 if there are packages available for an update.
    Returns 0 if no packages are available for update.
    Returns 1 if an error occurred.  

  This behavior causes a wrong result on minor updating of RHOSP 13. When running "openstack overcloud update run" in this case, it shows the message "Nothing to do here, all packages are up to date" as result (please see [2] in Additional info).  I think it should be failed because the metadata is expired and network is disconnected.

  In my opinion, this is the problem with regard to RHEL not to RHOSP.

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

  Red Hat Enterprise Linux 7.7

How reproducible:

  always

Steps to Reproduce:

  1. Run the following command as root privilege:

    # yum clean all

  2. Run the following command as root privilege:

    # yum check-update

  3. Disconnect network:

    # ip route del default
    (If you run the NetworkManager, please run "systemctl stop NetworkManager" as well.)

 
  4. Add the following 2 lines to /etc/yum.conf for making metadata to expire on purpose:
  
    metadata_expire=1

  5. Wait for a while (approximately 3 minutes).

  6. Run the following command as root privilege:

    # yum check-update

    Output:
      Loaded plugins: product-id, search-disabled-repos, subscription-manager
      https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/os/repodata/repomd.xml: [Errno 14] curl#7 - "Failed to connect to 23.42.76.83: Network is unreachable"
      Trying other mirror.
      https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/os/repodata/repomd.xml: [Errno 14] curl#7 - "Failed to connect to 23.42.76.83: Network is unreachable"
      Trying other mirror.
          : (snip)

  7. Check the exit code:

    # echo $?
    It should return 0 or 100.

  If you don't get the output like the above in 6, try to do 6 and 7 a few times.
  
Actual results:

  It returns exit code of 0 or 100.

Expected results:

  It should return exit code of 1.

Additional info:

In this case, yum command goes through the line 1483(if statement) in
yumRepo.py[1]. "self.skip_if_unavailable" is checked in this "if"
statement, but I guess that it should check "not self.skip_if_unavailable" in this line.
Is my guess correct?


[1] yum/yumRepo.py:

   1465     def _commonLoadRepoXML(self, text, mdtypes=None):
   1466         """ Common LoadRepoXML for instant and group, returns False if you
   1467             should just return. """
   1468         local  = self.cachedir + '/repomd.xml'
   1469         if self._repoXML is not None:
   1470             return False
   1471 
   1472         if self._cachingRepoXML(local):
   1473             caching = True
   1474             result = local
   1475         else:
   1476             caching = False
   1477             if self._latestRepoXML(local):
   1478                 result = local
   1479                 old_data = self._oldRepoMDData
   1480                 self._repoXML = old_data['old_repo_XML']
   1481             else:
   1482                 result = self._getFileRepoXML(local, text)
   1483                 if result is None:
   1484                     if (self.skip_if_unavailable and hasattr(self, '_metadata_cache_req')
   1485                         and self._metadata_cache_req in ('write', 'read-only:future')):
   1486                         # Since skip_if_unavailable=True, we can just disable this repo
   1487                         raise Errors.RepoError, "Can't download repomd.xml for %s" % self.ui_id
   1488 
   1489                     # Ignore this as we have a copy
   1490                     self._revertOldRepoXML()
   1491                     return False
   1492 



[2] ansible/modules/packaging/os/yum.py:

   1091 def latest(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos, en_plugins, dis_plugins, update_only, installroot='/'):
   1092 
   1093     res = {}
   1094     res['results'] = []
   1095     res['msg'] = ''
   1096     res['changed'] = False
   1097     res['rc'] = 0
   1098     pkgs = {}
   1099     pkgs['update'] = []
   1100     pkgs['install'] = []
   1101     updates = {}
   1102     update_all = False
   1103     cmd = None
   1104 
   1105     # determine if we're doing an update all
   1106     if '*' in items:
   1107         update_all = True
   1108 
   1109     rc, out, err = run_check_update(module, yum_basecmd)
   1110 
   1111     if rc == 0 and update_all:
   1112         res['results'].append('Nothing to do here, all packages are up to date')
   1113         return res
   1114     elif rc == 100:
   1115         updates = parse_check_update(out)
   1116     elif rc == 1:
   1117         res['msg'] = err
   1118         res['rc'] = rc
   1119         module.fail_json(**res)
   1120 

   1045 def run_check_update(module, yum_basecmd):
   1046     # run check-update to see if we have packages pending
   1047     rc, out, err = module.run_command(yum_basecmd + ['check-update'])
   1048     return rc, out, err

Comment 3 RHEL Program Management 2020-04-29 07:37:14 UTC
Development Management has reviewed and declined this request. You may appeal this decision by using your Red Hat support channels, who will make certain  the issue receives the proper prioritization with product and development management.

https://www.redhat.com/support/process/production/#howto


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