From 43cfb89c2abbc74be5ec4cf3601a52be3fafdb12 Mon Sep 17 00:00:00 2001 From: Sloane Hertel Date: Thu, 7 Jun 2018 20:01:50 -0400 Subject: [PATCH] 2.5 backport #40720 - fix cache timeout behavior (#41018) * Fix cache timeout behavior (cherry picked from commit c1400ce9091a6fcf2c2db465b5c1fbd01cce9447) * changelog --- changelogs/fragments/fix_cache_timeout_0.yaml | 2 ++ lib/ansible/plugins/cache/__init__.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/fix_cache_timeout_0.yaml diff --git a/changelogs/fragments/fix_cache_timeout_0.yaml b/changelogs/fragments/fix_cache_timeout_0.yaml new file mode 100644 index 0000000000..d9f830fdc5 --- /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 76aed24783..2396a6e574 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: