-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix inventory cache interface #50446
Conversation
6932d86
to
8de8310
Compare
This comment has been minimized.
This comment has been minimized.
63eef49
to
b8a7db4
Compare
This comment has been minimized.
This comment has been minimized.
Co-Authored-By: s-hertel <shertel@redhat.com>
Co-Authored-By: s-hertel <shertel@redhat.com>
06e2449
to
d78e0be
Compare
Rebased for porting guide conflict. |
@FutureTecSystems It looks like you have some valuable pieces in lib/ansible/plugins/inventory/foreman.py in that PR. I think it might be out of the scope of this pull request. I've tried to limit my changes to only those necessary for getting cache plugins to be functional with inventory plugins, so optimizing foreman may be better as a follow up PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @s-hertel for creating and updating the docs for this. Last docs changes suggested.
Co-Authored-By: s-hertel <shertel@redhat.com>
Co-Authored-By: s-hertel <shertel@redhat.com>
I'm hitting this message
with the openstack inventory plugin. What does this mean? Is this automatically worthy of creating a new issue in your issue queue, since it looks like the message is directed at the maintainers of the inventory plugin itself, and the openstack inventory plugin is a part of Ansible. |
SUMMARY
There are a number of problems with the current cache interface, the primary ones being that the developer interface is terrible and it only handles file-backed cache plugins.
Some of the interface problems are that the cache was difficult to set up, get() was expected to raise a KeyError, and the cache had to be set a particular way to be reflected in the backing plugin.
This allows self._cache to be used as a dictionary - e.g. if you want a KeyError, use
__getattr__
instead ofget
. It also updates the backing cache plugin with the value of self._cache if it has been modified after parse is called so the developer doesn't need to worry about the discrepancy between the cache object being exposed (a dictionary) and the permanent cache store (CacheModule).Added tests and developer documentation.
ISSUE TYPE