From 8d324e6a50459641fb654e4b921ebb8418a6643d Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Fri, 1 May 2015 13:57:13 -0400 Subject: [PATCH] Fix pylint error on "cachefile does not exist" Since cachefile is used to show the error message when stat fail, the variable need to be declared. --- lib/ansible/cache/jsonfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/cache/jsonfile.py b/lib/ansible/cache/jsonfile.py index 9c45dc22fd7..0bade893a82 100644 --- a/lib/ansible/cache/jsonfile.py +++ b/lib/ansible/cache/jsonfile.py @@ -108,6 +108,7 @@ class CacheModule(BaseCacheModule): return keys def contains(self, key): + cachefile = "%s/%s" % (self._cache_dir, key) if key in self._cache: return True @@ -115,7 +116,7 @@ class CacheModule(BaseCacheModule): if self.has_expired(key): return False try: - st = os.stat("%s/%s" % (self._cache_dir, key)) + st = os.stat(cachefile) return True except (OSError,IOError), e: if e.errno == errno.ENOENT: