diff --git a/changelogs/fragments/fix_cache_timeout_0.yaml b/changelogs/fragments/fix_cache_timeout_0.yaml new file mode 100644 index 00000000000..d9f830fdc52 --- /dev/null +++ b/changelogs/fragments/fix_cache_timeout_0.yaml @@ -0,0 +1,2 @@ +bugfixes: + - A cache timeout of 0 means the cache will not expire. diff --git a/lib/ansible/plugins/cache/__init__.py b/lib/ansible/plugins/cache/__init__.py index 76aed247834..2396a6e5747 100644 --- a/lib/ansible/plugins/cache/__init__.py +++ b/lib/ansible/plugins/cache/__init__.py @@ -153,7 +153,7 @@ class BaseFileCacheModule(BaseCacheModule): def has_expired(self, key): if self._timeout == 0: - return True + return False cachefile = "%s/%s" % (self._cache_dir, key) try: