FactCache changes

* Fix FactCache to conform to the dict API
  * update needs to take a dict rather than a key and a value
  * __init__ needs to allow for setting the intial dictionary
* Remove unneeded _display and _cache attributes
* Move ansible.plugins.cache.FactCache to
  ansible.vars.fact_cache.FactCache because this isn't part of the cache
  plugin API.
* Add backwards compatibility when calling update on the new FactCache
* Remove code for calling old FactCache. There's no way to call the old
  FactCache so there's no need for backwards compatible code for calling
  code.  Backwards compatibility is handling things which are calling
  the new FactCache.
* Port our code to the new FactCache location.
This commit is contained in:
Toshio Kuratomi 2018-12-04 11:17:31 -08:00
parent 6096f57880
commit 33f0c1ce22
7 changed files with 127 additions and 79 deletions

View file

@ -73,13 +73,12 @@ EXAMPLES = '''
import os
from itertools import product
from ansible import constants as C
from ansible.errors import AnsibleParserError
from ansible.plugins.cache import FactCache
from ansible.plugins.inventory import BaseInventoryPlugin
from itertools import product
class InventoryModule(BaseInventoryPlugin):
""" constructs groups and vars using Jinja2 template expressions """
@ -90,8 +89,6 @@ class InventoryModule(BaseInventoryPlugin):
super(InventoryModule, self).__init__()
self._cache = FactCache()
def verify_file(self, path):
valid = False