-
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
FactCache updates #5534
FactCache updates #5534
Conversation
* Support state=absent with group or a group meta key * Add auto_increment attribute to allow specification of a group without forcing an auto incrementing host number * Add additional example that showcases exact_count functionality * Don't use a file handle for files to upload to the server, read in the contents to avoid an issue where the file handle wasn't reset and an empty file was being uploaded
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
fixing Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
key Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
collections.mutablemappings as alternative Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
fixed issue with setter Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
new facts or default (dict). corrected setdefault param mismatch Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
behaviour) added __contains__ method in cache currently merges local cache with facts, for some reason 'in' doesn't seem to match existing keys. Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
- now checks if cachd_dir is actualy a dir - cached function returns list of cached keys/hosts - now stats file to se if it has 'expired' Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
…, and should be expunged.
…arning Fixes ansible#5513. set is built-in since 2.4 and deprecated since 2.6
…po. symetric should be symmetric. I fixed the typo and verified that the filter in core.py is spelled correctly.
… 'register' and bypass.
While looking into filters, I noticed that the documentation has a typo....
…ng the need for 'bypass'. Defining the 'keys' method of the plugin is also likely adviseable next.
…mplementation is as efficient as we'd want it to be.
Adding support for detecting RHEV Hypervisor in ansible_virtualization_type
rax module: improvements
* The get method of a dict does not internally call __getitem__, so add a get method that does * When trying to update subkeys of self.SETUP_CACHE make sure to use utils.update_hash
Actually, this doesn't seem to be the full fix for the 'memory' FactCache plugin. It works for a memcached plugin I am working on, but not for memory. Still looking, to see if I can figure out the issue there too. |
Looks like we don't want this as this no longer defers the implementation of getitem to the plugin. I'm looking at the email on the thread now. |
Can you share an example of where this causes a problem with a playbook? |
The following playbook suffers from the issue ---
- hosts: localhost
gather_facts: yes
connection: local
tasks:
- set_fact:
foo: bar
- command: echo test
register: echo
- debug: var=foo
- debug: var=echo In both cases,
This is straight off of devel:
This happens with the default 'memory' fact cache plugin. I also experience this with my memcached plugin, which you can see at https://github.com/sivel/ansible/compare/memcached-factcache The fix in this pull request resolves the issue with my memcached plugin, but does not fix the issue with the memory plugin. I haven't figured out why yet, but I can see that with the following debug, these vars are indeed in the value from utils.update_hash: diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py
index d32506e..e4114c2 100644
--- a/lib/ansible/utils/__init__.py
+++ b/lib/ansible/utils/__init__.py
@@ -963,6 +963,7 @@ def update_hash(hash, key, new_value):
value = hash.get(key, {})
value.update(new_value)
+ print value
hash[key] = value |
So top part is good, but I think setitem is still called for the bottom part. |
We have reset to before this commit so shouldn't be a probelm. We want to do some refactoring before I think we're ready for this. |
__getitem__
, so add a get method that doesCurrently
utils.update_hash
usesFactCache.get()
which does not internally utilize the__getitem__
method, so it is always returning{}
These are just a few missed from 3ba0ea0