def needsLock(base, logger): def waitLock(): while True: try: base.doLock() except Errors.LockError, e: if "%s" %(e.msg,) != lockerr: lockerr = "%s" %(e.msg,) logger.critical(lockerr) logger.critical(_("Another app is currently holding the yum lock; waiting for it to exit...")) time.sleep(2) else: break def lockFun(f): def newFun(*args, **kw): waitLock() return f(*args, **kw) return newFun return countFun