Package yum :: Module config
[hide private]
[frames] | no frames]

Module config

source code

Configuration parser and default values for yum.

Classes [hide private]
  Option
This class handles a single Yum configuration file option.
  ListOption
An option containing a list of strings.
  UrlOption
This option handles lists of URLs with validation of the URL scheme.
  UrlListOption
Option for handling lists of URLs with validation of the URL scheme.
  IntOption
An option representing an integer value.
  PositiveIntOption
An option representing a positive integer value, where 0 can have a special represention.
  SecondsOption
An option representing an integer value of seconds, or a human readable variation specifying days, hours, minutes or seconds until something happens.
  BoolOption
An option representing a boolean value.
  FloatOption
An option representing a numeric float value.
  SelectionOption
Handles string values where only specific values are allowed
  CaselessSelectionOption
Mainly for compat.
  BytesOption
An option representing a value in bytes.
  ThrottleOption
An option representing a bandwidth throttle value.
  BaseConfig
Base class for storing configuration definitions.
  StartupConf
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.
  YumConf
Configuration option definitions for yum.conf's [main] section.
  RepoConf
Option definitions for repository INI file sections.
  VersionGroupConf
Functions [hide private]
 
Inherit(option_obj)
Clone an Option instance for the purposes of inheritance.
source code
 
readStartupConfig(configfile, root)
Parse Yum's main configuration file and return a StartupConf instance.
source code
 
readMainConfig(startupconf)
Parse Yum's main configuration file
source code
 
readVersionGroupsConfig(configfile='/etc/yum/version-groups.conf') source code
 
getOption(conf, section, name, option)
Convenience function to retrieve a parsed and converted value from a ConfigParser.
source code
 
_getEnvVar()
Return variable replacements from the environment variables YUM0 to YUM9
source code
 
_getsysver(installroot, distroverpkg)
Calculate the release version for the system.
source code
 
writeRawRepoFile(repo, only=None)
Writes changes in a repo object back to a .repo file.
source code
Variables [hide private]
  _use_iniparse = True
  __pkgs_gpgcheck_default__ = False
  __repo_gpgcheck_default__ = False
  __package__ = 'yum'
Function Details [hide private]

Inherit(option_obj)

source code 

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_obj - Option instance to inherit.
Returns:
New Option instance inherited from the input.

readStartupConfig(configfile, root)

source code 

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.

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

readMainConfig(startupconf)

source code 

Parse Yum's main configuration file

Parameters:
  • startupconf - StartupConf instance as returned by readStartupConfig()
Returns:
Populated YumConf instance.

getOption(conf, section, name, option)

source code 

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

Parameters:
  • conf - ConfigParser instance or similar
  • section - Section name
  • name - Option name
  • option - Option instance to use for conversion.
Returns:
The parsed value or default if value was not present.

Will raise ValueError if the option could not be parsed.

_getEnvVar()

source code 

Return variable replacements from the environment variables YUM0 to YUM9

The result is intended to be used with parser.varReplace()

_getsysver(installroot, distroverpkg)

source code 

Calculate the release version for the system.

Parameters:
  • installroot - The value of the installroot option.
  • distroverpkg - The value of the distroverpkg option.
Returns:
The release version as a string (eg. '4' for FC4)

writeRawRepoFile(repo, only=None)

source code 

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

Parameters:
  • repo - Repo Object
  • only - List of attributes to work on (None = All) It work by reading the repo file, changes the values there shall be changed and write it back to disk.