diff --git a/examples/ansible.cfg b/examples/ansible.cfg index e6bc86cffb0..61e1f612340 100644 --- a/examples/ansible.cfg +++ b/examples/ansible.cfg @@ -132,6 +132,13 @@ filter_plugins = /usr/share/ansible_plugins/filter_plugins # avoid issues. #http_user_agent = ansible-agent +# if set to a persistant type (not 'memory', for example 'redis') fact values +# from previous runs in Ansible will be stored. This may be useful when +# wanting to use, for example, IP information from one group of servers +# without having to talk to them in the same playbook run to get their +# current IP information. +fact_caching = memory + [paramiko_connection] # uncomment this line to cause the paramiko connection plugin to not record new host diff --git a/lib/ansible/cache/file.py b/lib/ansible/cache/file.py index 3171ee76f5e..677c2f887b9 100644 --- a/lib/ansible/cache/file.py +++ b/lib/ansible/cache/file.py @@ -1,4 +1,4 @@ -# (c) 2014, Michael DeHaan +# (c) 2014, Brian Coca, Josh Drake, et al # # This file is part of Ansible # @@ -14,6 +14,7 @@ # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . + from __future__ import absolute_import import collections diff --git a/lib/ansible/cache/memcached.py b/lib/ansible/cache/memcached.py index ae4b3fc9a03..bd3730d280d 100644 --- a/lib/ansible/cache/memcached.py +++ b/lib/ansible/cache/memcached.py @@ -1,4 +1,4 @@ -# (c) 2014, Michael DeHaan +# (c) 2014, Brian Coca, Josh Drake, et al # # This file is part of Ansible # @@ -14,6 +14,7 @@ # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . + import collections import os import sys diff --git a/lib/ansible/cache/memory.py b/lib/ansible/cache/memory.py index f948de1b7eb..e9a151d1290 100644 --- a/lib/ansible/cache/memory.py +++ b/lib/ansible/cache/memory.py @@ -1,4 +1,4 @@ -# (c) 2014, Michael DeHaan +# (c) 2014, Brian Coca, Josh Drake, et al # # This file is part of Ansible # @@ -15,7 +15,6 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . - class CacheModule(object): def __init__(self, *args, **kwargs): diff --git a/lib/ansible/cache/redis.py b/lib/ansible/cache/redis.py index 52d4adf2a61..98db2215b34 100644 --- a/lib/ansible/cache/redis.py +++ b/lib/ansible/cache/redis.py @@ -1,4 +1,4 @@ -# (c) 2014, Michael DeHaan +# (c) 2014, Brian Coca, Josh Drake, et al # # This file is part of Ansible # @@ -14,9 +14,10 @@ # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . -from __future__ import absolute_import +from __future__ import absolute_import import collections +# FIXME: can we store these as something else before we ship it? import cPickle import sys import time @@ -33,7 +34,7 @@ except ImportError: class PickledRedis(StrictRedis): """ - A subclass of StricRedis that uses the pickle module to store and load + A subclass of StrictRedis that uses the pickle module to store and load representations of the provided values. """ def get(self, name): diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py index b9a5eb0fa51..9b183568a30 100644 --- a/lib/ansible/constants.py +++ b/lib/ansible/constants.py @@ -148,7 +148,7 @@ DEFAULT_VARS_PLUGIN_PATH = get_config(p, DEFAULTS, 'vars_plugins', ' DEFAULT_FILTER_PLUGIN_PATH = get_config(p, DEFAULTS, 'filter_plugins', 'ANSIBLE_FILTER_PLUGINS', '/usr/share/ansible_plugins/filter_plugins') DEFAULT_LOG_PATH = shell_expand_path(get_config(p, DEFAULTS, 'log_path', 'ANSIBLE_LOG_PATH', '')) -CACHE_PLUGIN = get_config(p, DEFAULTS, 'cache_plugin', 'ANSIBLE_CACHE_PLUGIN', 'memory') +CACHE_PLUGIN = get_config(p, DEFAULTS, 'fact_caching', 'ANSIBLE_CACHE_PLUGIN', 'memory') CACHE_PLUGIN_CONNECTION = get_config(p, DEFAULTS, 'cache_plugin_connection', 'ANSIBLE_CACHE_PLUGIN_CONNECTION', None) CACHE_PLUGIN_PREFIX = get_config(p, DEFAULTS, 'cache_plugin_prefix', 'ANSIBLE_CACHE_PLUGIN_PREFIX', 'ansible_facts') CACHE_PLUGIN_TIMEOUT = get_config(p, DEFAULTS, 'cache_plugin_timeout', 'ANSIBLE_CACHE_PLUGIN_TIMEOUT', (60 * 60 * 24), integer=True) diff --git a/test/units/TestUtils.py b/test/units/TestUtils.py index 5591384336b..cc3e6e354e9 100644 --- a/test/units/TestUtils.py +++ b/test/units/TestUtils.py @@ -697,10 +697,14 @@ class TestUtils(unittest.TestCase): ) # invalid quote detection - with self.assertRaises(Exception): - split_args('hey I started a quote"') - with self.assertRaises(Exception): - split_args('hey I started a\' quote') + try: + with self.assertRaises(Exception): + split_args('hey I started a quote"') + with self.assertRaises(Exception): + split_args('hey I started a\' quote') + except TypeError: + # you must be on Python 2.6 still, FIXME + pass # jinja2 loop blocks with lots of complexity _test_combo(