yum.plugins

DeprecatedInt

class yum.plugins.DeprecatedInt

Bases: int

A simple int subclass that is used to check when a deprecated constant is used.

PluginYumExit

class yum.plugins.PluginYumExit(value='', translation_domain='')

Bases: exceptions.Exception

Exception that can be raised by plugins to signal that yum should stop.

YumPlugins

class yum.plugins.YumPlugins(base, searchpath, optparser=None, types=None, pluginconfpath=None, disabled=None, enabled=None)

Manager class for Yum plugins.

run(slotname, **kwargs)

Run all plugin functions for the given slot.

Parameters:
  • slotname – a string representing the name of the slot to run the plugins for
  • kwargs – keyword arguments that will be simply passed on to the plugins
setCmdLine(opts, commands)

Set the parsed command line options so that plugins can access them.

Parameters:
  • opts – a dictionary containing the values of the command line options
  • commands – a list of command line arguments passed to yum

DummyYumPlugins

class yum.plugins.DummyYumPlugins

This class provides basic emulation of the YumPlugins class. It exists so that calls to plugins.run() don’t fail if plugins aren’t in use.

run(*args, **kwargs)

Do nothing. All arguments are unused.

setCmdLine(*args, **kwargs)

Do nothing. All arguments are unused.

PluginConduit

class yum.plugins.PluginConduit(parent, base, conf)

A conduit class to transfer information between yum and the plugin.

confBool(section, opt, default=None)

Read a boolean value from the plugin’s own configuration file

Parameters:
  • section – configuration file section to read
  • opt – option name to read
  • default – value to read if the option is missing
Returns:

boolean option value read, or default if the option was missing or could not be parsed

confFloat(section, opt, default=None)

Read a float value from the plugin’s own configuration file.

Parameters:
  • section – configuration file section to read
  • opt – option name to read
  • default – value to read if the option is missing
Returns:

float option value read, or default if the option was missing or could not be parsed

confInt(section, opt, default=None)

Read an integer value from the plugin’s own configuration file.

Parameters:
  • section – configuration file section to read
  • opt – option name to read
  • default – value to read if the option is missing
Returns:

the integer option value read, or default if the option was missing or could not be parsed

confString(section, opt, default=None)

Read a string value from the plugin’s own configuration file.

Parameters:
  • section – configuration file section to read
  • opt – option name to read
  • default – value to read if the option is missing
Returns:

string option value read, or default if option was missing

error(level, msg)

Send an error message to the logger.

Parameters:
  • level – the level of the message to send
  • msg – the message to send
getOptParser()

Return the optparse.OptionParser instance for this execution of Yum. In the “config” and “init” slots a plugin may add extra options to this instance to extend the command line options that Yum exposes. In all other slots a plugin may only read the OptionParser instance. Any modification of the instance at this point will have no effect. See the PreRepoSetupPluginConduit.getCmdLine() method for details on how to retrieve the parsed values of command line options.

Returns:the global optparse.OptionParser instance used by Yum. May be None if an OptionParser isn’t in use
getYumVersion()

Return a string representing the current version of yum.

info(level, msg)

Send an info message to the logger.

Parameters:
  • level – the level of the message to send
  • msg – the message to send
promptYN(msg)

Return a yes or no response, either from assumeyes already being set, or from prompting the user.

Parameters:msg – the message to prompt the user with
Returns:1 if the response is yes, and 0 if the response is no
registerPackageName(name)

Register the name of a package to use.

Parameters:name – the name of the package to register

ConfigPluginConduit

class yum.plugins.ConfigPluginConduit(parent, base, conf)

Bases: yum.plugins.PluginConduit

A conduit for use in the config slot.

registerCommand(command)

Register a new command.

Parameters:command – the command to register
Raises :yum.Errors.ConfigError if the registration of commands is not supported
registerOpt(name, valuetype, where, default)

Deprecated. Register a yum configuration file option.

Parameters:
  • name – name of the new option
  • valuetype – option type (PLUG_OPT_BOOL, PLUG_OPT_STRING, etc.)
  • where – where the option should be available in the config file (PLUG_OPT_WHERE_MAIN, PLUG_OPT_WHERE_REPO, etc)
  • default – default value for the option if it is not set by the user

PostConfigPluginConduit

class yum.plugins.PostConfigPluginConduit(parent, base, conf)

Bases: yum.plugins.ConfigPluginConduit

Conduit for use in the postconfig slot.

getConf()

Return a dictionary containing the values of the configuration options.

Returns:a dictionary containing the values of the configuration options

InitPluginConduit

class yum.plugins.InitPluginConduit(parent, base, conf)

Bases: yum.plugins.PluginConduit

Conduit for use in the init slot.

getConf()

Return a dictionary containing the values of the configuration options.

Returns:a dictionary containing the values of the configuration options
getRepos()

Return Yum’s container object for all configured repositories.

Returns:Yum’s yum.repos.RepoStorage instance

ArgsPluginConduit

class yum.plugins.ArgsPluginConduit(parent, base, conf, args)

Bases: yum.plugins.InitPluginConduit

Conduit for dealing with command line arguments.

getArgs()

Return a list of the command line arguments passed to yum.

Returns:a list of the command line arguments passed to yum

PreRepoSetupPluginConduit

class yum.plugins.PreRepoSetupPluginConduit(parent, base, conf)

Bases: yum.plugins.InitPluginConduit

Conduit for use in the prererosetup slot.

getCmdLine()

Return parsed command line options.

Returns:(options, commands) as returned by OptionParser.parse_args()
getRpmDB()

Return a representation of the local RPM database. This allows querying of installed packages.

Returns:a yum.rpmUtils.RpmDBHolder instance

PostRepoSetupPluginConduit

class yum.plugins.PostRepoSetupPluginConduit(parent, base, conf)

Bases: yum.plugins.PreRepoSetupPluginConduit

Conduit for use in the postreposetup slot.

getGroups()

Return group information.

Returns:yum.comps.Comps instance

DownloadPluginConduit

class yum.plugins.DownloadPluginConduit(parent, base, conf, pkglist, errors=None)

Bases: yum.plugins.PostRepoSetupPluginConduit

Conduit for use in the download slots.

getDownloadPackages()

Return a list of package objects representing packages to be downloaded.

Returns:a list of package object representing packages to be downloaded
getErrors()

Return a dictionary of download errors.

Returns:a dictionary of download errors. This dictionary is indexed by package object. Each element is a list of strings describing the error

MainPluginConduit

class yum.plugins.MainPluginConduit(parent, base, conf)

Bases: yum.plugins.PostRepoSetupPluginConduit

Main conduit class for plugins. Many other conduit classes will inherit from this class.

delPackage(po)

Delete the given package from the package sack.

Parameters:po – the package object to delete
getPackageByNevra(nevra)

Retrieve a package object from the packages loaded by Yum using nevra information.

Parameters:nevra – a tuple holding (name, epoch, version, release, arch) for a package
Returns:a yum.packages.PackageObject instance (or subclass)
getPackages(repo=None)

Return a list of packages.

Parameters:repo – the repo to return a packages from
Returns:a list of package objects
getTsInfo()

Return transaction set.

Returns:the transaction set

DepsolvePluginConduit

class yum.plugins.DepsolvePluginConduit(parent, base, conf, rescode=None, restring=[])

Bases: yum.plugins.MainPluginConduit

Conduit for use in solving dependencies.

CompareProvidersPluginConduit

class yum.plugins.CompareProvidersPluginConduit(parent, base, conf, providers_dict={}, reqpo=None)

Bases: yum.plugins.MainPluginConduit

Conduit to compare different providers of packages.

HistoryPluginConduit

class yum.plugins.HistoryPluginConduit(parent, base, conf, rescode=None, restring=[])

Bases: yum.plugins.MainPluginConduit

Conduit to access information about the yum history.

VerifyPluginConduit

class yum.plugins.VerifyPluginConduit(parent, base, conf, verify_package)

Bases: yum.plugins.MainPluginConduit

Conduit to verify packages.

yum.plugins.parsever(apiver)

Parse a string representing an api version.

Parameters:apiver – a string representing an api version
Returns:a tuple containing the major and minor version numbers
yum.plugins.apiverok(a, b)

Return true if API version “a” supports API version “b”

Parameters:
  • a – a string representing an api version
  • b – a string representing an api version
Returns:

whether version a supports version b