本文整理汇总了Python中yum.i18n.exception2msg函数的典型用法代码示例。如果您正苦于以下问题:Python exception2msg函数的具体用法?Python exception2msg怎么用?Python exception2msg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了exception2msg函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: rpmdb_warn_checks
def rpmdb_warn_checks():
try:
probs = base._rpmdb_warn_checks(out=verbose_logger.info, warn=False)
except Errors.YumBaseError, e:
# This is mainly for PackageSackError from rpmdb.
verbose_logger.info(_(" Yum checks failed: %s"), exception2msg(e))
probs = []
开发者ID:Distrotech,项目名称:yum,代码行数:7,代码来源:yummain.py
示例2: exIOError
def exIOError(self, e):
if e.errno == 32:
self.logger.critical(_('\n\nExiting on Broken Pipe'))
else:
self.logger.critical(_('\n\n%s') % exception2msg(e))
if self.unlock(): return 200
return 1
开发者ID:rhauser,项目名称:ayum,代码行数:7,代码来源:utils.py
示例3: waitForLock
def waitForLock(self):
lockerr = ""
while True:
try:
self.doLock()
except Errors.LockError, e:
if exception2msg(e) != lockerr:
lockerr = exception2msg(e)
self.logger.critical(lockerr)
if not self.conf.exit_on_lock:
self.logger.critical("Another app is currently holding the yum lock; waiting for it to exit...")
show_lock_owner(e.pid, self.logger)
time.sleep(2)
else:
raise Errors.YumBaseError, _("Another app is currently holding the yum lock; exiting as configured by exit_on_lock")
else:
break
开发者ID:rhauser,项目名称:ayum,代码行数:17,代码来源:utils.py
示例4: exIOError
def exIOError(e):
if e.errno == 32:
logger.critical(_("\n\nExiting on Broken Pipe"))
else:
logger.critical(_("\n\n%s") % exception2msg(e))
if unlock():
return 200
return 1
开发者ID:TheApacheCats,项目名称:yum,代码行数:8,代码来源:yummain.py
示例5: main
def main(self):
# Add command line option specific to yumdownloader
self.addCmdOptions()
# Parse the commandline option and setup the basics.
try:
opts = self.doUtilConfigSetup()
except yum.Errors.RepoError, e:
self.logger.error(exception2msg(e))
sys.exit(50)
开发者ID:pnasrat,项目名称:yum-utils,代码行数:9,代码来源:yumdownloader.py
示例6: exFatal
def exFatal(self, e):
"""Output a message stating that a fatal error has occurred.
:param e: the exception
:return: the exit code
"""
self.logger.critical('\n\n%s', exception2msg(e))
if self.unlock(): return 200
return 1
开发者ID:akozumpl,项目名称:yum,代码行数:9,代码来源:utils.py
示例7: downloadPackages
def downloadPackages(self,opts):
toDownload = []
packages = self.cmds
for pkg in packages:
toActOn = []
if not pkg or pkg[0] != '@':
pkgnames = [pkg]
else:
group_string = pkg[1:]
pkgnames = set()
for grp in self.comps.return_groups(group_string):
if 'mandatory' in self.conf.group_package_types:
pkgnames.update(grp.mandatory_packages)
if 'default' in self.conf.group_package_types:
pkgnames.update(grp.default_packages)
if 'optional' in self.conf.group_package_types:
pkgnames.update(grp.optional_packages)
if self.conf.enable_group_conditionals:
for condreq, cond in grp.conditional_packages.iteritems():
if self.isPackageInstalled(cond):
pkgnames.add(condreq)
if not pkgnames:
self.logger.error('No packages for group %s' % group_string)
continue
pos = self.pkgSack.returnPackages(patterns=pkgnames)
exactmatch, matched, unmatched = parsePackages(pos, pkgnames)
installable = (exactmatch + matched)
if not installable:
try:
installable = self.returnPackagesByDep(pkg)
installable = yum.misc.unique(installable)
except yum.Errors.YumBaseError, msg:
self.logger.error(exception2msg(msg))
continue
if not installable: # doing one at a time, apart from groups
self.logger.error('No Match for argument %s' % pkg)
continue
for newpkg in installable:
toActOn.extend(_best_convert_pkg2srcpkgs(self, opts, newpkg))
if toActOn:
pkgGroups = self._groupPackages(toActOn)
for group in pkgGroups:
pkgs = pkgGroups[group]
if opts.source:
toDownload.extend(self.bestPackagesFromList(pkgs, 'src'))
elif opts.archlist:
for arch in opts.archlist.split(','):
toDownload.extend(self.bestPackagesFromList(pkgs, arch))
else:
toDownload.extend(self.bestPackagesFromList(pkgs))
开发者ID:pnasrat,项目名称:yum-utils,代码行数:56,代码来源:yumdownloader.py
示例8: exRepoError
def exRepoError(e):
# For RepoErrors ... help out by forcing new repodata next time.
# XXX: clean only the repo that has failed?
try:
base.cleanExpireCache()
except Errors.YumBaseError:
# Let's not confuse the user further (they don't even know we tried
# the clean).
pass
msg = _("""\
One of the configured repositories failed (%(repo)s),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=%(repoid)s ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable %(repoid)s
or
subscription-manager repos --disable=%(repoid)s
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=%(repoid)s.skip_if_unavailable=true
""")
repoui = _('Unknown')
repoid = _('<repoid>')
try:
repoid = e.repo.id
repoui = e.repo.name
except AttributeError:
pass
msg = msg % {'repoid' : repoid, 'repo' : repoui}
logger.critical('\n\n%s\n%s', msg, exception2msg(e))
if unlock(): return 200
return 1
开发者ID:henrysher,项目名称:yum,代码行数:56,代码来源:yummain.py
示例9: exPluginExit
def exPluginExit(self, e):
'''Called when a plugin raises PluginYumExit.
Log the plugin's exit message if one was supplied.
''' # ' xemacs hack
exitmsg = exception2msg(e)
if exitmsg:
self.logger.warn('\n\n%s', exitmsg)
if self.unlock(): return 200
return 1
开发者ID:rhauser,项目名称:ayum,代码行数:10,代码来源:utils.py
示例10: doUtilConfigSetup
def doUtilConfigSetup(self,args = sys.argv[1:],pluginsTypes=(plugins.TYPE_CORE,)):
"""Parse command line options, and perform configuration.
:param args: list of arguments to use for configuration
:param pluginsTypes: a sequence specifying the types of
plugins to load
:return: a dictionary containing the values of command line options
"""
# Parse only command line options that affect basic yum setup
opts = self._parser.firstParse(args)
# go through all the setopts and set the global ones
self._parseSetOpts(opts.setopts)
if self.main_setopts:
for opt in self.main_setopts.items:
setattr(opts, opt, getattr(self.main_setopts, opt))
# Just print out the version if that's what the user wanted
if opts.version:
self._printUtilVersion()
sys.exit(0)
# get the install root to use
root = self._parser.getRoot(opts)
if opts.quiet:
opts.debuglevel = 0
if opts.verbose:
opts.debuglevel = opts.errorlevel = 6
# Read up configuration options and initialise plugins
try:
pc = self.preconf
pc.fn = opts.conffile
pc.root = root
pc.init_plugins = not opts.noplugins
pc.plugin_types = pluginsTypes
pc.optparser = self._parser
pc.debuglevel = opts.debuglevel
pc.errorlevel = opts.errorlevel
if hasattr(opts, "disableplugins"):
pc.disabled_plugins =self._parser._splitArg(opts.disableplugins)
if hasattr(opts, "enableplugins"):
pc.enabled_plugins = self._parser._splitArg(opts.enableplugins)
if hasattr(opts, "releasever"):
pc.releasever = opts.releasever
self.conf
# now set all the non-first-start opts from main from our setopts
if self.main_setopts:
for opt in self.main_setopts.items:
setattr(self.conf, opt, getattr(self.main_setopts, opt))
except Errors.ConfigError, e:
self.logger.critical(_('Config Error: %s'), exception2msg(e))
sys.exit(1)
开发者ID:akozumpl,项目名称:yum,代码行数:55,代码来源:utils.py
示例11: exPluginExit
def exPluginExit(e):
"""Called when a plugin raises PluginYumExit.
Log the plugin's exit message if one was supplied.
""" # ' xemacs hack
exitmsg = exception2msg(e)
if exitmsg:
logger.warn("\n\n%s", exitmsg)
if unlock():
return 200
return 1
开发者ID:TheApacheCats,项目名称:yum,代码行数:11,代码来源:yummain.py
示例12: doUtilYumSetup
def doUtilYumSetup(self):
"""do a default setup for all the normal/necessary yum components,
really just a shorthand for testing"""
# FIXME - we need another way to do this, I think.
try:
self.waitForLock()
self._getTs()
self._getRpmDB()
self._getRepos(doSetup = True)
self._getSacks()
except Errors.YumBaseError, msg:
self.logger.critical(exception2msg(msg))
sys.exit(1)
开发者ID:rhauser,项目名称:ayum,代码行数:13,代码来源:utils.py
示例13: exPluginExit
def exPluginExit(self, e):
"""Called when a plugin raises
:class:`yum.plugins.PluginYumExit`. Log the plugin's exit
message if one was supplied.
:param e: the exception
:return: the exit code
""" # ' xemacs hack
exitmsg = exception2msg(e)
if exitmsg:
self.logger.warn('\n\n%s', exitmsg)
if self.unlock(): return 200
return 1
开发者ID:akozumpl,项目名称:yum,代码行数:13,代码来源:utils.py
示例14: exIOError
def exIOError(self, e):
"""Output a message stating that the program is exiting due to
an IO exception.
:param e: the IO exception
:return: the exit code
"""
if e.errno == 32:
self.logger.critical(_('\n\nExiting on Broken Pipe'))
else:
self.logger.critical(_('\n\n%s') % exception2msg(e))
if self.unlock(): return 200
return 1
开发者ID:akozumpl,项目名称:yum,代码行数:13,代码来源:utils.py
示例15: __init__
def __init__(self):
YumUtilBase.__init__(self, YumDownloader.NAME, YumDownloader.VERSION, YumDownloader.USAGE)
self.logger = logging.getLogger("yum.verbose.cli.yumdownloader")
self.localPackages = []
# Add util commandline options to the yum-cli ones
self.optparser = self.getOptionParser()
try:
self.main()
except (OSError, IOError), e:
self.logger.error(exception2msg(e))
sys.exit(1)
开发者ID:sean797,项目名称:yum-utils-1,代码行数:13,代码来源:yumdownloader.py
示例16: waitForLock
def waitForLock(self):
"""Establish the yum lock. If another process is already
holding the yum lock, by default this method will keep trying
to establish the lock until it is successful. However, if
:attr:`self.conf.exit_on_lock` is set to True, it will
raise a :class:`Errors.YumBaseError`.
"""
lockerr = ""
while True:
try:
self.doLock()
except Errors.LockError, e:
if exception2msg(e) != lockerr:
lockerr = exception2msg(e)
self.logger.critical(lockerr)
if not self.conf.exit_on_lock:
self.logger.critical("Another app is currently holding the yum lock; waiting for it to exit...")
show_lock_owner(e.pid, self.logger)
time.sleep(2)
else:
raise Errors.YumBaseError, _("Another app is currently holding the yum lock; exiting as configured by exit_on_lock")
else:
break
开发者ID:akozumpl,项目名称:yum,代码行数:23,代码来源:utils.py
示例17: show_lock_owner
def show_lock_owner(pid, logger):
"""Output information about another process that is holding the
yum lock.
:param pid: the process id number of the process holding the yum
lock
:param logger: the logger to output the information to
:return: a dictionary containing information about the process.
This is the same as the dictionary returned by
:func:`get_process_info`.
"""
try:
ps = get_process_info(pid)
except IOError, e:
logger.critical("%s", exception2msg(e))
ps = None
开发者ID:akozumpl,项目名称:yum,代码行数:16,代码来源:utils.py
示例18: install_deps
def install_deps(self, deplist, opts):
errors = set()
for dep in deplist:
self.logger.debug(' REQ: %s' % dep)
if dep.startswith("rpmlib("):
continue
instreq = self.returnInstalledPackagesByDep(dep)
if instreq:
self.logger.info(' --> Already installed : %s' % instreq[0])
continue
try:
pkg = self.returnPackageByDep(dep)
self.logger.info(' --> %s' % pkg)
self.install(pkg)
except yum.Errors.YumBaseError, e:
errors.add(exception2msg(e))
开发者ID:henrysher,项目名称:yum-utils,代码行数:16,代码来源:yum-builddep.py
示例19: doUtilYumSetup
def doUtilYumSetup(self,opts):
"""do a default setup for all the normal/necessary yum components,
really just a shorthand for testing"""
try:
# Setup source repos
if opts.source:
self.setupSourceRepos()
self._getRepos(doSetup = True)
# if '--source' is used the add src to the archlist
if opts.source:
archlist = rpmUtils.arch.getArchList() + ['src']
elif opts.archlist:
archlist = []
for a in opts.archlist.split(','):
archlist.extend(rpmUtils.arch.getArchList(a))
else:
archlist = rpmUtils.arch.getArchList()
self._getSacks(archlist=archlist)
except yum.Errors.YumBaseError, msg:
self.logger.critical(exception2msg(msg))
sys.exit(1)
开发者ID:pnasrat,项目名称:yum-utils,代码行数:21,代码来源:yumdownloader.py
示例20: dequeue
def dequeue(self, block=True):
""" Try to De-Queue a delta rebuild and spawn the rebuild process. """
# Do this here, just to keep the zombies at bay...
self._wait()
if not self._future_jobs:
return False
if self.limit <= len(self.jobs):
if not block:
return False
self.wait(len(self.jobs) - self.limit + 1)
po = self._future_jobs.pop(0)
args = ("-a", po.arch)
if po.oldrpm:
args += "-r", po.oldrpm
args += po.localpath, po.rpm.localpath
try:
pid = os.spawnl(os.P_NOWAIT, APPLYDELTA, APPLYDELTA, *args)
except OSError, e:
raise MiscError, _("Couldn't spawn %s: %s") % (APPLYDELTA, exception2msg(e))
开发者ID:dmnks,项目名称:yum,代码行数:23,代码来源:drpm.py
注:本文中的yum.i18n.exception2msg函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论