YumConf - file /etc/yum.conf
- class insights.parsers.yum_conf.YumConf(context)[source]
Bases:
IniConfigFile
This module provides parsing for the
/etc/yum.conf
file. TheYumConf
class parses the information in the file/etc/yum.conf
. See theIniConfigFile
class for more information on attributes and methods.Sample input data looks like:
[main] cachedir=/var/cache/yum/$basearch/$releasever keepcache=0 debuglevel=2 logfile=/var/log/yum.log exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 installonly_limit=3 [rhel-7-server-rpms] metadata_expire = 86400 baseurl = https://cdn.redhat.com/content/rhel/server/7/$basearch name = Red Hat Enterprise Linux 7 Server (RPMs) gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release enabled = 1 gpgcheck = 1
Examples
>>> type(yconf) <class 'insights.parsers.yum_conf.YumConf'> >>> 'main' in yconf True >>> 'rhel-7-server-rpms' in yconf True >>> yconf.has_option('main', 'gpgcheck') True >>> yconf.has_option('main', 'foo') False >>> yconf.get('rhel-7-server-rpms', 'enabled') '1' >>> expected = {'obsoletes': '1', 'keepcache': '0', 'logfile': '/var/log/yum.log', 'cachedir': '/var/cache/yum/$basearch/$releasever', 'exactarch': '1', 'plugins': '1', 'gpgcheck': '1', 'debuglevel': '2', 'installonly_limit': '3'} >>> yconf.items('main') == expected True