# /]# python -c 'import yum, json yb = yum.YumBase() print json.dumps(yb.conf.yumvar, indent=2)' # /]# /usr/libexec/platform-python -c 'import dnf, json db = () print(json.dumps(db.conf.substitutions, indent=2))' Python -c 'import yum, pprint yb = yum.YumBase() pprint.pprint(yb.conf.yumvar, width=1)' Python -c 'import yum, simplejson as json yb = yum.YumBase() print json.dumps(yb.conf.yumvar, indent=2)' RHEL/CentOS 4 and 5 # if you install python-simplejson RHEL/CentOS 6 and 7 python -c 'import yum, json yb = yum.YumBase() print json.dumps(yb.conf.yumvar, indent=2)' RHEL/CentOS 8: /usr/libexec/platform-python -c 'import dnf, json db = () print(json.dumps(db.conf.substitutions, indent=2))' The answer has been updated to use json and updated to include RHEL/CentOS 8 by modifying answer for Fedora. It is now 2020 and all current versions of RHEL/CentOS have json by default for python. When this answer was written in 2011, json wasn't installed for python by default for all the versions of RHEL/CentOS at that time so I used pprint to print the stuff nicely. Is there a way to view these variables by using the yum commandline utility? I would prefer to not hunt down the version of the 'redhat-release' package, or manually get the value of os.uname() in Python. Variable does not exist then the configuration file variable will not $YUM0-$YUM9 These will be replaced with the value of the shellĮnvironment variable of the same name. $basearch This will be replaced with your base architecture in yum.įor example, if your $arch is i686 your $basearch will be i386. This defaults to the version ofĪrchitecture as listed by os.uname() in Python. $releasever This will be replaced with the value of the version of the Options including name, baseurl and commands. They are available in the values of several There are a number of variables you can use to ease maintenance of The yum.conf(5) manpage gives some information about these variables: : PYCURL ERROR 22 - "The requested URL returned error: 404"Įrror: Cannot retrieve repository metadata (repomd.xml) for repository: sl. I need to know why is Scientific Linux trying to grab this URL, when I was expecting it to grab another URL: # yum install package I am setting up a yum repository, and need to debug some of the URLs in the yum.conf file.
0 Comments
Leave a Reply. |