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
commit 33f0c1ce22
7 changed files with 127 additions and 79 deletions

View file

@ -52,6 +52,18 @@ Deprecated
vars:
ansible_aync_dir: /tmp/.ansible_async
* Plugin writers who need a ``FactCache`` object should be aware of two deprecations:
1. The ``FactCache`` class has moved from ``ansible.plugins.cache.FactCache`` to
``ansible.vars.fact_cache.FactCache``. This is because the ``FactCache`` is not part of the
cache plugin API and cache plugin authors should not be subclassing it. ``FactCache`` is still
available from its old location but will issue a deprecation warning when used from there. The
old location will be removed in Ansible 2.12.
2. The ``FactCache.update()`` method has been converted to follow the dict API. It now takes a
dictionary as its sole argument and updates itself with the dictionary's items. The previous
API where ``update()`` took a key and a value will now issue a deprecation warning and will be
removed in 2.12.
Modules
=======