Due to the following deprecation warnings: [DEPRECATION WARNING]: InventoryModule should utilize self._cache as a dict instead of self.cache. When expecting a KeyError, use self._cache[key] instead of using self.cache.get(key). self._cache is a dictionary and will return a default value instead of raising a KeyError when the key does not exist. This feature will be removed in version 2.12.
[DEPRECATION WARNING]: InventoryModule should utilize self._cache as a dict instead of self.cache. To set the self._cache dictionary, use self._cache[key] = value instead of self.cache.set(key, value). To force update the underlying cache plugin with the contents of self._cache before parse() is complete, call self.set_cache_plugin and it will use the self._cache dictionary to update the cache plugin. This feature will be removed in version 2.12. I've updated my custom inventory plugins: def _fetch(self, url): cache_key = self.get_cache_key(url) if self.attempt_to_read_cache: try: # return self.cache.get(cache_key) # Old stable-2.7 method return self._cache[cache_key] # New stable-2.8+ method except KeyError: display.debug("cache miss") self.cache_needs_update = True results = self._process_url(url) if self.cache_needs_update: # self.cache.set(cache_key, results) # Old stable-2.7 method self._cache[cache_key] = results # New stable-2.8+ method (not working in stable-2.7!) return results However, when running this with Ansible 2.7, the cache doesn't get flushed to disk, so each attempt to read the cache results in a cache miss. Is there any way to make this backwards compatible with Ansible 2.7 without causing a DeprecationWarning? -- You received this message because you are subscribed to the Google Groups "Ansible Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/2d2e06af-d166-416b-bda0-78237358d3bb%40googlegroups.com.