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
Esempio n. 2
0
 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 = []
    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
 def exFatal(e):
     logger.critical('\n\n%s', exception2msg(e.value))
     if unlock(): return 200
     return 1
    # do our cli parsing and config file setup
    # also sanity check the things being passed on the cli
    try:
        base.getOptionsConfig(args)
    except plugins.PluginYumExit, e:
        return exPluginExit(e)
    except Errors.YumBaseError, e:
        return exFatal(e)

    lockerr = ""
    while True:
        try:
            base.doLock()
        except Errors.LockError, e:
            if exception2msg(e) != lockerr:
                lockerr = exception2msg(e)
                logger.critical(lockerr)
            if (e.errno not in (errno.EPERM, errno.EACCES) and
                not base.conf.exit_on_lock):
                logger.critical(_("Another app is currently holding the yum lock; waiting for it to exit..."))
                tm = 0.1
                if show_lock_owner(e.pid, logger):
                    tm = 2
                time.sleep(tm)
            elif e.errno in (errno.EPERM, errno.EACCES):
                logger.critical(_("Can't create lock file; exiting"))
                return 1
            else:
                logger.critical(_("Another app is currently holding the yum lock; exiting as configured by exit_on_lock"))
                return 1