Why can't python yum module scan outdated fixes?

I use the check-update yum command in centos to get a list of updates and also provide outdated packages. Below is the centos command for a list of updates, and you can see the list below.

[root@CentOS7-G2-3 ~]# yum check-update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.xmission.com
* extras: linux.mirrors.es.net
* updates: mirror.web-ster.com
Obsoleting Packages
python-gobject-base.x86_64  3.22.0-1.el7_4.1    updates  
pygobject3-base.x86_64  3.14.0-3.el7        @anaconda
rdma-core.i686          13-7.el7        base     
rdma.noarch         7.3_4.7_rc2-6.el7_3 @updates 
rdma-core.x86_64        13-7.el7        base     
rdma.noarch         7.3_4.7_rc2-6.el7_3 @updates

But when I run under python scripts, it does not show outdated packages. and why doesn't it show outdated packages? Is there any way to get these legacy packages? Below python code cannot scan outdated fixes for centos.

import yum
from distutils import version
yumObj = yum.YumBase()
YUM_VER = version.StrictVersion(yum.__version__)
YUM_MAJOR = YUM_VER.version[0]
if YUM_MAJOR == 2:
    yumObj.doTsSetup()
    yumObj.doRepoSetup()
    yumObj.doRepoSetup()
updates = yumObj.doPackageLists('updates').updates
print "updates:"+str(updates)

script execution output shown below:

[root@CentOS7-G2-3 ~]# python
 Python 2.7.5 (default, Aug  4 2017, 00:39:18) 
 [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import yum
 >>> yumObj = yum.YumBase()
 >>> from distutils import version
 >>> YUM_VER = version.StrictVersion(yum.__version__)
 >>> YUM_VER
 StrictVersion ('3.4.3')
 >>> YUM_MAJOR = YUM_VER.version[0]
 >>> YUM_MAJOR
 3
 >>> updates = yumObj.doPackageLists('updates').updates
 Loaded plugins: fastestmirror
 Loading mirror speeds from cached hostfile
  * base: mirrors.xmission.com
  * extras: linux.mirrors.es.net
  * updates: mirror.web-ster.com
 >>> print "updates:"+str(updates)
 updates:[]
 >>> 
+4
source share

Source: https://habr.com/ru/post/1693240/


All Articles