diff options
author | Toshio Kuratomi <a.badger@gmail.com> | 2017-06-12 08:00:44 -0700 |
---|---|---|
committer | Brian Coca <bcoca@users.noreply.github.com> | 2017-06-13 09:50:46 -0400 |
commit | 90b1d780eba42fa352ac845f4c6464afe97932a1 (patch) | |
tree | 30573a7955b393c7dbcb24b9912792ea90cda69f /lib/ansible/plugins/cache | |
parent | 498aea8acc2f9eb64228f505547ceedaae4f2687 (diff) | |
download | ansible-90b1d780eba42fa352ac845f4c6464afe97932a1.tar.gz |
Fix redis cache for python3
According to the redis-py docs, zrank will return the 0 based index for
the value in the sorted set. So the logic here wasn't right to begin
with (It just means that a value at the 0-th position would never show
up as cached). Need to compare against None to know if the value
exists in the cache.
https://redis-py.readthedocs.io/en/latest/#redis.StrictRedis.zrank
Fixes #25590
Diffstat (limited to 'lib/ansible/plugins/cache')
-rw-r--r-- | lib/ansible/plugins/cache/redis.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ansible/plugins/cache/redis.py b/lib/ansible/plugins/cache/redis.py index c0e5d4b534..8e51b6b5bf 100644 --- a/lib/ansible/plugins/cache/redis.py +++ b/lib/ansible/plugins/cache/redis.py @@ -84,7 +84,7 @@ class CacheModule(BaseCacheModule): def contains(self, key): self._expire_keys() - return (self._cache.zrank(self._keys_set, key) >= 0) + return (self._cache.zrank(self._keys_set, key) is not None) def delete(self, key): self._cache.delete(self._make_key(key)) |