From d590f10d32b5a3c9417a5be021ba5ddfc6f1f453 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 31 Oct 2018 15:34:05 -0400 Subject: [PATCH] remove redundant md5 hashing --- changelogs/fragments/remove_redundant_md5.yml | 3 +++ lib/ansible/plugins/inventory/__init__.py | 7 +------ 2 files changed, 4 insertions(+), 6 deletions(-) create mode 100644 changelogs/fragments/remove_redundant_md5.yml diff --git a/changelogs/fragments/remove_redundant_md5.yml b/changelogs/fragments/remove_redundant_md5.yml new file mode 100644 index 0000000000..f9fed40a9a --- /dev/null +++ b/changelogs/fragments/remove_redundant_md5.yml @@ -0,0 +1,3 @@ +bugfixes: + - remove rendundant path uniquifying in inventory plugins. This removes + use of md5 hashing and fixes inventory plugins when run in FIPS mode. diff --git a/lib/ansible/plugins/inventory/__init__.py b/lib/ansible/plugins/inventory/__init__.py index 032e3136bd..2dd9eeefd9 100644 --- a/lib/ansible/plugins/inventory/__init__.py +++ b/lib/ansible/plugins/inventory/__init__.py @@ -250,7 +250,7 @@ class Cacheable(object): _cache = {} def get_cache_key(self, path): - return "{0}_{1}_{2}".format(self.NAME, self._get_cache_prefix(path), self._get_config_identifier(path)) + return "{0}_{1}".format(self.NAME, self._get_cache_prefix(path)) def _get_cache_prefix(self, path): ''' create predictable unique prefix for plugin/inventory ''' @@ -265,11 +265,6 @@ class Cacheable(object): return 's_'.join([d1[:5], d2[:5]]) - def _get_config_identifier(self, path): - ''' create predictable config-specific prefix for plugin/inventory ''' - - return hashlib.md5(path.encode()).hexdigest() - def clear_cache(self): self._cache = {}