From f309d57591a74c19cc0723d9dcdba65fcdd667e1 Mon Sep 17 00:00:00 2001 From: Michael E Brown Date: Mon, 3 Dec 2007 11:08:49 -0600 Subject: init yumCacheLock file object in __init__. No need to wait until tryLock to open it. --- py/mock/plugins/yum_cache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/mock/plugins/yum_cache.py b/py/mock/plugins/yum_cache.py index be2e44e..7da61a3 100644 --- a/py/mock/plugins/yum_cache.py +++ b/py/mock/plugins/yum_cache.py @@ -38,6 +38,7 @@ class YumCache(object): rootObj.addHook("preinit", self._yumCachePreInitHook) rootObj.umountCmds.append('umount -n %s/var/cache/yum' % rootObj.rootdir) rootObj.mountCmds.append('mount -n --bind %s %s/var/cache/yum' % (self.yumSharedCachePath, rootObj.rootdir)) + self.yumCacheLock = open(os.path.join(self.yumSharedCachePath, "yumcache.lock"), "a+") # ============= # 'Private' API @@ -67,7 +68,6 @@ class YumCache(object): mock.util.mkdirIfAbsent(self.yumSharedCachePath) # lock so others dont accidentally use yum cache while we operate on it. - self.yumCacheLock = open(os.path.join(self.yumSharedCachePath, "yumcache.lock"), "a+") self._yumCachePreYumHook() if self.online: -- cgit