James Cammarata
91500f8f5f
Fix include param precedence in variable manager
2015-11-19 09:01:51 -05:00
James Cammarata
180159b01d
Adding vars back in and trying to add a little more speed by avoiding copies
2015-11-17 14:44:46 -05:00
James Cammarata
f10d2c57c8
Restoring templating of hostvars returned by __getitem__
2015-11-17 10:19:56 -05:00
James Cammarata
9f31c073fe
Fixing a few bugs in the HostVars performance areas
...
* Also refresh inventory in the HostVars manager process when things
are changed via add_host/group_by
* Raise j2undefined rather than return it
2015-11-17 09:15:10 -05:00
James Cammarata
5cbeab5a3c
Performance improvements for HostVars and some bugfixes
2015-11-16 17:15:52 -05:00
nitzmahone
3bb1f7a561
hostvars should return j2 undefined as instance, not type
...
Looks like someone forgot to create an instance of undefined here- we were returning the undefined type object, which broke all the undefined checks.
Added an integration test around add_host that will catch this (separate PR to follow)
2015-11-16 09:58:23 -08:00
Toshio Kuratomi
62979efa14
Finish up plugin porting to global display
...
Also remove display = display which does nothing
2015-11-11 10:44:23 -08:00
James Cammarata
566144461f
Remove internal use of display and use the top-level import
2015-11-10 12:02:29 -05:00
James Cammarata
09994c18f3
Correct logic around determining environment variable existence
...
Fixes #13105
2015-11-09 21:04:24 -05:00
James Cammarata
ccbcfcddfc
Move where we add environment and make it conditional on not existing
...
Also displays a warning now, because users should not be using that variable
name as it causes a collision with the internal variable of the same name.
2015-11-09 16:28:54 -05:00
James Cammarata
937584cd52
Ensure 'environment' is set in the magic variables
...
Fixes #13033
2015-11-09 14:50:39 -05:00
James Cammarata
7e04947599
Be more selective about what variables we cache during templating
...
Fixes #13087
2015-11-09 14:07:48 -05:00
James Cammarata
dd4ca66e1e
Make sure hostvars cache is recreated during serialization
2015-11-06 22:21:50 -05:00
James Cammarata
5040abaaf2
Merge branch 'devel_cache_for_do_template_call' of https://github.com/Yannig/ansible into Yannig-devel_cache_for_do_template_call
2015-11-06 22:04:52 -05:00
James Cammarata
63c47fb271
Fixing up performance
2015-11-05 16:22:37 -05:00
Brian Coca
483c25a609
Revert "switched host patterns to use sets, simplified logic which now uses buitins"
...
need this to be lists, for order and other considerations
This reverts commit 8e2f0b3f2c
.
2015-11-05 15:41:17 -05:00
Brian Coca
8e2f0b3f2c
switched host patterns to use sets, simplified logic which now uses buitins
2015-11-05 15:02:06 -05:00
Yannig Perre
ccbdd6229a
Use static vars when computing host vars known to be static (inventory_hostname, inventory_dir etc.).
2015-11-04 22:16:14 +01:00
Yannig Perré
30f827d92d
Fix python3 test.
2015-11-03 11:52:09 +01:00
Yannig Perré
4a8d1703d4
New patch against hostvars.py. With this patch, Ansible run lose 50% of time.
...
Little rewrite of previous patch to use sha1 signature.
Use fail_on_undefined to compute sha1 signature.
2015-11-02 21:04:20 +01:00
Toshio Kuratomi
4203850d1a
Break apart a looped dependency to show a warning when parsing playbooks
...
Display a warning when a dict key is overwritten by pyyaml
Fixes #12888
2015-10-27 12:39:42 -07:00
James Cammarata
cace91df56
Allow hostvars cache to be invalidated so hostvars contain all hosts after add_host
...
Fixes #12925
2015-10-27 14:12:17 -04:00
Brian Coca
7ebfe72015
added missing string_types
2015-10-24 15:49:30 -04:00
Brian Coca
8ce864db6f
sanatize results
2015-10-24 15:23:12 -04:00
James Cammarata
498c27d09a
Re-adding role_names magic variable
...
Fixes #12863
2015-10-22 11:06:47 -04:00
Brian Coca
08c9e70307
made display part of variable manager and corrected reference to it
...
fixes #12859
2015-10-21 22:29:27 -04:00
Toshio Kuratomi
99e7bb35c1
Simplify UnsafeProxy as we don't need to use it for byte strings, only text
2015-10-20 10:57:23 -07:00
Toshio Kuratomi
f34b55ac2b
Add python3-compat boilerplate to all .py files in lib/ansible
2015-10-19 18:36:19 -07:00
James Cammarata
0bbe9d5bd0
Make hostvars json/yaml serializable in filters
...
Fixes #12615
2015-10-18 10:09:05 -04:00
Toshio Kuratomi
baa309309d
Bundle a new version of python-six for compatibility along with some code to make it easy for distributions to override the bunndled copy if they have a new enough version.
2015-10-16 08:21:28 -07:00
Brian Coca
aee6de5a76
group_names should not include implied 'all', fixes #12763
2015-10-15 11:46:43 -04:00
Marius Gedminas
e511d6d458
Make UnsafeProxy work on Python 3
...
Instead of str and unicode we have to deal with bytes and str.
2015-10-13 09:41:08 +03:00
Marius Gedminas
af6a316d9b
Remove unused import
...
Fixes ImportError: No module named '__builtin__' on Python 3.
2015-10-13 09:37:48 +03:00
James Cammarata
cd2cb178ae
Totally rework the way UnsafeProxy does things
2015-10-12 18:13:09 -04:00
James Cammarata
d15fcf05f0
Fix bug in the way temp vars were created for templating vars_files
...
Fixes #12711
2015-10-12 12:17:45 -04:00
Ben Keith
1f82971283
Adding the inventory_file var back
2015-10-10 21:54:28 -04:00
Matthew Jones
7da478a4f4
Fix an issue where cache plugins weren't updated
...
The first call to persisting facts would work due to the assignment of a
MutableMapping calling __setitem__ but subsequent module fact data would
not be propogated to the fact cache plugins because update() doesn't
invoke __setitem__. This changes the behavior a little bit and ensures
set() is called on cache plugins.
2015-10-09 11:16:41 -04:00
James Cammarata
d91b3c6b9d
Make sure magic variables are available when templating vars_files
...
Also does some reorganization/cleanup on the magic vars/delegated
variable generation portions of VariableManager to make the above
possible.
Fixes #12633
2015-10-05 16:32:58 -04:00
James Cammarata
3bd71d0619
Use delegated_to field for play context remote_addr, if none other exists
...
Fixes #12527
2015-09-30 09:27:29 -04:00
James Cammarata
bb1101498d
Clean up typo from cdc6c52
2015-09-25 16:58:27 -04:00
James Cammarata
cdc6c5208e
Clean string data run through the template engine
...
Also strip UnsafeProxy off of low level srings and objects to ensure
they don't cause issues later down the road
Fixes #12513
2015-09-25 16:49:31 -04:00
James Cammarata
ccddda1ebc
Merge pull request #12502 from mgedmin/py3k
...
Python 3: make test_variable_manager_precedence pass
2015-09-25 03:05:02 -04:00
James Cammarata
31d5f88a1d
Use the task loop to calculate multiple delegated hosts
...
Due to the way we're now calculating delegate_to, if that value is based
on a loop variable ('item') we need to calculate all of the possible
delegated_to variables for that loop.
Fixes #12499
2015-09-25 01:41:09 -04:00
James Cammarata
95b371dd60
Use AnsibleFileNotFound instead of AnsibleParsingError when YAML files are not found
...
And update portions of code to expect the proper error.
Fixes #12512
2015-09-24 16:27:25 -04:00
James Cammarata
12df9f2e31
Make hostvars more dynamic again to improve performance with large inventories
...
Fixes #12477
2015-09-24 13:53:44 -04:00
Marius Gedminas
6d4618f46f
Python 3: there's no dict.iteritems()
2015-09-24 12:50:00 +03:00
James Cammarata
1164e83477
Remove unnecessary calls to save inventory restrictions since 81bf88b
2015-09-23 12:18:09 -04:00
James Cammarata
95c6fe88e4
Fix handling of conditional vars_files which contain variables
...
Fixes #12484
2015-09-23 01:26:24 -04:00
James Cammarata
1076155d8d
When failing because of vars_files templating, try and bubble up the file/line info
2015-09-22 12:13:55 -04:00
James Cammarata
0fb4a6a67b
Tweak to the way new host variables are created for delegated hosts
2015-09-22 03:03:21 -04:00