yum.config

Configuration parser and default values for yum.

Option

class yum.config.Option(default=None, parse_default=False)

Bases: object

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

clone()

Return a safe copy of this Option instance.

Returns:a safe copy of this Option instance
parse(s)

Parse the string value to the Option‘s native value.

Parameters:s – raw string value to parse
Returns:validated native value
Raise :ValueError if there was a problem parsing the string. Subclasses should override this
setup(obj, name)

Initialise the option for a config instance. This must be called before the option can be set or retrieved.

Parameters:
  • objBaseConfig (or subclass) instance.
  • name – Name of the option.
tostring(value)

Convert the Option‘s native value to a string value. This does the opposite of the parse() method above. Subclasses should override this.

Parameters:value – native option value
Returns:string representation of input
yum.config.Inherit(option_obj)

Clone an Option instance for the purposes of inheritance. The returned instance has all the same properties as the input Option and shares items such as the default value. Use this to avoid redefinition of reused options.

Parameters:option_objOption instance to inherit
Returns:New Option instance inherited from the input

ListOption

class yum.config.ListOption(default=None, parse_default=False)

Bases: yum.config.Option

An option containing a list of strings.

parse(s)

Convert a string from the config file to a workable list, parses globdir: paths as foo.d-style dirs.

Parameters:s – The string to be converted to a list. Commas and whitespace are used as separators for the list
Returns:s converted to a list
tostring(value)

Convert a list of to a string value. This does the opposite of the parse() method above.

Parameters:value – a list of values
Returns:string representation of input

UrlOption

class yum.config.UrlOption(default=None, schemes=('http', 'ftp', 'file', 'https'), allow_none=False)

Bases: yum.config.Option

This option handles lists of URLs with validation of the URL scheme.

parse(url)

Parse a url to make sure that it is valid, and in a scheme that can be used.

Parameters:url – a string containing the url to parse
Returns:url if it is valid
Raises :ValueError if there is an error parsing the url

UrlListOption

class yum.config.UrlListOption(default=None, schemes=('http', 'ftp', 'file', 'https'), parse_default=False)

Bases: yum.config.ListOption

Option for handling lists of URLs with validation of the URL scheme.

parse(s)

Parse a string containing multiple urls into a list, and ensure that they are in a scheme that can be used.

Parameters:s – the string to parse
Returns:a list of strings containing the urls in s
Raises :ValueError if there is an error parsing the urls

IntOption

class yum.config.IntOption(default=None, range_min=None, range_max=None)

Bases: yum.config.Option

An option representing an integer value.

parse(s)

Parse a string containing an integer.

Parameters:s – the string to parse
Returns:the integer in s
Raises :ValueError if there is an error parsing the integer

PositiveIntOption

class yum.config.PositiveIntOption(default=None, range_min=0, range_max=None, names_of_0=None)

Bases: yum.config.IntOption

An option representing a positive integer value, where 0 can have a special representation.

parse(s)
Parse a string containing a positive integer, where 0 can
have a special representation.
Parameters:s – the string to parse
Returns:the integer in s
Raises :ValueError if there is an error parsing the integer

SecondsOption

class yum.config.SecondsOption(default=None, parse_default=False)

Bases: yum.config.Option

An option representing an integer value of seconds, or a human readable variation specifying days, hours, minutes or seconds until something happens. Works like BytesOption. Note that due to historical president -1 means “never”, so this accepts that and allows the word never, too.

Valid inputs: 100, 1.5m, 90s, 1.2d, 1d, 0xF, 0.1, -1, never. Invalid inputs: -10, -0.1, 45.6Z, 1d6h, 1day, 1y.

Return value will always be an integer

parse(s)

Parse a string containing an integer value of seconds, or a human readable variation specifying days, hours, minutes or seconds until something happens. Works like BytesOption. Note that due to historical president -1 means “never”, so this accepts that and allows the word never, too.

Valid inputs: 100, 1.5m, 90s, 1.2d, 1d, 0xF, 0.1, -1, never. Invalid inputs: -10, -0.1, 45.6Z, 1d6h, 1day, 1y.

Parameters:s – the string to parse
Returns:an integer representing the number of seconds specified by s
Raises :ValueError if there is an error parsing the string

BoolOption

class yum.config.BoolOption(default=None, parse_default=False)

Bases: yum.config.Option

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

parse(s)

Parse a string containing a boolean value. 1, yes, and true will evaluate to True; and 0, no, and false will evaluate to False. Case is ignored.

Parameters:s – the string containing the boolean value
Returns:the boolean value contained in s
Raises :ValueError if there is an error in parsing the boolean value
tostring(value)

Convert a boolean value to a string value. This does the opposite of the parse() method above.

Parameters:value – the boolean value to convert
Returns:a string representation of value

FloatOption

class yum.config.FloatOption(default=None, parse_default=False)

Bases: yum.config.Option

An option representing a numeric float value.

parse(s)

Parse a string containing a numeric float value.

Parameters:s – a string containing a numeric float value to parse
Returns:the numeric float value contained in s
Raises :ValueError if there is an error parsing float value

SelectionOption

class yum.config.SelectionOption(default=None, allowed=(), mapper={})

Bases: yum.config.Option

Handles string values where only specific values are allowed.

parse(s)

Parse a string for specific values.

Parameters:s – the string to parse
Returns:s if it contains a valid value
Raises :ValueError if there is an error parsing the values

CaselessSelectionOption

class yum.config.CaselessSelectionOption(default=None, allowed=(), mapper={})

Bases: yum.config.SelectionOption

Mainly for compatibility with BoolOption, works like SelectionOption but lowers input case.

parse(s)

Parse a string for specific values.

Parameters:s – the string to parse
Returns:s if it contains a valid value
Raises :ValueError if there is an error parsing the values

BytesOption

class yum.config.BytesOption(default=None, parse_default=False)

Bases: yum.config.Option

An option representing a value in bytes. The value may be given in bytes, kilobytes, megabytes, or gigabytes.

parse(s)

Parse a friendly bandwidth option to bytes. The input should be a string containing a (possibly floating point) number followed by an optional single character unit. Valid units are ‘k’, ‘M’, ‘G’. Case is ignored. The convention that 1k = 1024 bytes is used.

Valid inputs: 100, 123M, 45.6k, 12.4G, 100K, 786.3, 0. Invalid inputs: -10, -0.1, 45.6L, 123Mb.

Parameters:s – the string to parse
Returns:the number of bytes represented by s
Raises :ValueError if the option can’t be parsed

ThrottleOption

class yum.config.ThrottleOption(default=None, parse_default=False)

Bases: yum.config.BytesOption

An option representing a bandwidth throttle value. See parse() for acceptable input values.

parse(s)

Get a throttle option. Input may either be a percentage or a “friendly bandwidth value” as accepted by the BytesOption.

Valid inputs: 100, 50%, 80.5%, 123M, 45.6k, 12.4G, 100K, 786.0, 0. Invalid inputs: 100.1%, -4%, -500.

Parameters:s – the string to parse
Returns:the bandwidth represented by s. The return value will be an int if a bandwidth value was specified, and a float if a percentage was given
Raises :ValueError if input can’t be parsed

BaseConfig

class yum.config.BaseConfig

Bases: object

Base class for storing configuration definitions. Subclass when creating your own definitions.

getConfigOption(option, default=None)

Return the current value of the given option.

Parameters:
  • option – string specifying the option to return the value of
  • default – the value to return if the option does not exist
Returns:

the value of the option specified by option, or default if it does not exist

classmethod isoption(name)

Return True if the given name refers to a defined option.

Parameters:
  • cls – the class to find the option in
  • name – the name of the option to search for
Returns:

whether name specifies a defined option

iteritems()

Yield (name, value) pairs for every option in the instance. The value returned is the parsed, validated option value.

iterkeys()

Yield the names of all defined options in the instance.

classmethod optionobj(name, exceptions=True)

Return the Option instance for the given name.

Parameters:
  • cls – the class to return the Option instance from
  • name – the name of the Option instance to return
  • exceptions – defines what action to take if the specified Option instance does not exist. If exceptions is True, a KeyError will be raised. If exceptions is False, None will be returned
Returns:

the Option instance specified by name, or None if it does not exist and exceptions is False

Raises :

KeyError if the specified Option does not exist, and exceptions is True

populate(parser, section, parent=None)

Set option values from an INI file section.

Parameters:
  • parserConfigParser instance (or subclass)
  • section – INI file section to read use
  • parent – Optional parent BaseConfig (or subclass) instance to use when doing option value inheritance
setConfigOption(option, value)

Set the value of the given option to the given value.

Parameters:
  • option – string specifying the option to set the value of
  • value – the value to set the option to
write(fileobj, section=None, always=())

Write out the configuration to a file-like object.

Parameters:
  • fileobj – File-like object to write to
  • section – Section name to use. If not specified, the section name used during parsing will be used
  • always – A sequence of option names to always write out. Options not listed here will only be written out if they are at non-default values. Set to None to dump out all options

StartupConf

class yum.config.StartupConf

Bases: yum.config.BaseConfig

Configuration option definitions for yum.conf’s [main] section that are required early in the initialisation process or before the other [main] options can be parsed.

config_file_path

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

debuglevel

An option representing an integer value.

distroverpkg

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

errorlevel

An option representing an integer value.

gaftonmode

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

installroot

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

persistdir

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

pluginconfpath

An option containing a list of strings.

pluginpath

An option containing a list of strings.

plugins

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

syslog_device

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

syslog_facility

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

syslog_ident

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

YumConf

class yum.config.YumConf

Bases: yum.config.StartupConf

Configuration option definitions for yum.conf’s [main] section.

Note: see also options inherited from StartupConf

alwaysprompt

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

assumeno

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

assumeyes

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

bandwidth

An option representing a value in bytes. The value may be given in bytes, kilobytes, megabytes, or gigabytes.

bugtracker_url

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

cachedir

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

clean_requirements_on_remove

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

color

Handles string values where only specific values are allowed.

color_list_available_downgrade

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

color_list_available_install

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

color_list_available_reinstall

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

color_list_available_upgrade

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

color_list_installed_extra

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

color_list_installed_newer

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

color_list_installed_older

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

color_list_installed_reinstall

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

color_search_match

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

color_update_installed

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

color_update_local

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

color_update_remote

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

commands

An option containing a list of strings.

disable_excludes

An option containing a list of strings.

diskspacecheck

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

dump()

Return a string representing the values of all the configuration options.

Returns:a string representing the values of all the configuration options
enable_group_conditionals

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

enabled

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

enablegroups

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

exactarch

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

exactarchlist

An option containing a list of strings.

exclude

An option containing a list of strings.

exit_on_lock

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

failovermethod

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

gpgcheck

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

group_package_types

An option containing a list of strings.

groupremove_leaf_only

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

history_list_view

Handles string values where only specific values are allowed.

history_record

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

history_record_packages

An option containing a list of strings.

http_caching

Handles string values where only specific values are allowed.

installonly_limit

An option representing a positive integer value, where 0 can have a special representation.

installonlypkgs

An option containing a list of strings.

ip_resolve

Mainly for compatibility with BoolOption, works like SelectionOption but lowers input case.

keepalive

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

keepcache

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

kernelpkgnames

An option containing a list of strings.

loadts_ignoremissing

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

loadts_ignorerpm

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

localpkg_gpgcheck

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

logfile

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

mdpolicy

An option containing a list of strings.

metadata_expire

An option representing an integer value of seconds, or a human readable variation specifying days, hours, minutes or seconds until something happens. Works like BytesOption. Note that due to historical president -1 means “never”, so this accepts that and allows the word never, too.

Valid inputs: 100, 1.5m, 90s, 1.2d, 1d, 0xF, 0.1, -1, never. Invalid inputs: -10, -0.1, 45.6Z, 1d6h, 1day, 1y.

Return value will always be an integer

mirrorlist_expire

An option representing an integer value of seconds, or a human readable variation specifying days, hours, minutes or seconds until something happens. Works like BytesOption. Note that due to historical president -1 means “never”, so this accepts that and allows the word never, too.

Valid inputs: 100, 1.5m, 90s, 1.2d, 1d, 0xF, 0.1, -1, never. Invalid inputs: -10, -0.1, 45.6Z, 1d6h, 1day, 1y.

Return value will always be an integer

multilib_policy

Handles string values where only specific values are allowed.

obsoletes

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

overwrite_groups

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

password

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

protected_multilib

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

protected_packages

An option containing a list of strings.

proxy

This option handles lists of URLs with validation of the URL scheme.

proxy_password

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

proxy_username

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

recent

An option representing an integer value.

repo_gpgcheck

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

reposdir

An option containing a list of strings.

retries

An option representing a positive integer value, where 0 can have a special representation.

rpm_check_debug

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

rpmverbosity

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

showdupesfromrepos

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

skip_broken

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

sslcacert

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

sslclientcert

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

sslclientkey

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

sslverify

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

throttle

An option representing a bandwidth throttle value. See parse() for acceptable input values.

timeout

An option representing a numeric float value.

tolerant

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

tsflags

An option containing a list of strings.

upgrade_requirements_on_install

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

username

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

RepoConf

class yum.config.RepoConf

Bases: yum.config.BaseConfig

Option definitions for repository INI file sections.

bandwidth

An option representing a value in bytes. The value may be given in bytes, kilobytes, megabytes, or gigabytes.

baseurl

Option for handling lists of URLs with validation of the URL scheme.

cost

An option representing an integer value.

enabled

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

enablegroups

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

exclude

An option containing a list of strings.

failovermethod

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

gpgcakey

Option for handling lists of URLs with validation of the URL scheme.

gpgcheck

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

gpgkey

Option for handling lists of URLs with validation of the URL scheme.

http_caching

Handles string values where only specific values are allowed.

includepkgs

An option containing a list of strings.

ip_resolve

Mainly for compatibility with BoolOption, works like SelectionOption but lowers input case.

iterkeys()

Yield the names of all defined options in the instance.

keepalive

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

mdpolicy

An option containing a list of strings.

mediaid

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

metadata_expire

An option representing an integer value of seconds, or a human readable variation specifying days, hours, minutes or seconds until something happens. Works like BytesOption. Note that due to historical president -1 means “never”, so this accepts that and allows the word never, too.

Valid inputs: 100, 1.5m, 90s, 1.2d, 1d, 0xF, 0.1, -1, never. Invalid inputs: -10, -0.1, 45.6Z, 1d6h, 1day, 1y.

Return value will always be an integer

This option handles lists of URLs with validation of the URL scheme.

mirrorlist

This option handles lists of URLs with validation of the URL scheme.

mirrorlist_expire

An option representing an integer value of seconds, or a human readable variation specifying days, hours, minutes or seconds until something happens. Works like BytesOption. Note that due to historical president -1 means “never”, so this accepts that and allows the word never, too.

Valid inputs: 100, 1.5m, 90s, 1.2d, 1d, 0xF, 0.1, -1, never. Invalid inputs: -10, -0.1, 45.6Z, 1d6h, 1day, 1y.

Return value will always be an integer

name

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

password

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

proxy

This option handles lists of URLs with validation of the URL scheme.

proxy_password

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

proxy_username

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

repo_gpgcheck

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

retries

An option representing a positive integer value, where 0 can have a special representation.

skip_if_unavailable

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

sslcacert

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

sslclientcert

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

sslclientkey

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

sslverify

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

throttle

An option representing a bandwidth throttle value. See parse() for acceptable input values.

timeout

An option representing a numeric float value.

username

This class handles a single Yum configuration file option. Create subclasses for each type of supported configuration option. Python descriptor foo (__get__ and __set__) is used to make option definition easy and concise.

VersionGroupConf

class yum.config.VersionGroupConf

Bases: yum.config.BaseConfig

Option definitions for version groups.

pkglist

An option containing a list of strings.

run_with_packages

An option representing a boolean value. The value can be one of 0, 1, yes, no, true, or false.

yum.config.readStartupConfig(configfile, root, releasever=None)

Parse Yum’s main configuration file and return a StartupConf instance. This is required in order to access configuration settings required as Yum starts up.

Parameters:
  • configfile – the path to yum.conf
  • root – the base path to use for installation (typically ‘/’)
Returns:

A StartupConf instance

Raises :

Errors.ConfigError if a problem is detected with while parsing.

yum.config.readMainConfig(startupconf)

Parse Yum’s main configuration file

Parameters:startupconfStartupConf instance as returned by readStartupConfig()
Returns:Populated YumConf instance
yum.config.readVersionGroupsConfig(configfile='/etc/yum/version-groups.conf')

Parse the configuration file for version groups.

Parameters:configfile – the configuration file to read
Returns:a dictionary containing the parsed options
yum.config.getOption(conf, section, name, option)

Convenience function to retrieve a parsed and converted value from a ConfigParser.

Parameters:
  • conf – ConfigParser instance or similar
  • section – Section name
  • nameOption name
  • optionOption instance to use for conversion
Returns:

The parsed value or default if value was not present

Raises :

ValueError if the option could not be parsed

yum.config.writeRawRepoFile(repo, only=None)

Write changes in a repo object back to a .repo file.

Parameters:
  • repo – the Repo Object to write back out
  • only – list of attributes to work on. If only is None, all options will be written out