Compare commits

...

7 commits

Author SHA1 Message Date
Michael DeHaan
ad675235e2 Keep git history out of submodules when building src distribution 2014-11-27 20:08:48 -05:00
James Cammarata
6598c83b02 Version bump for release 1.8.1 2014-11-26 21:42:25 -06:00
Brian Coca
5b3c82f4ba fine tuned lookup/templating errors 2014-11-26 21:35:26 -06:00
Toshio Kuratomi
e5344a7167 Integration tests for #9242 and #9640 2014-11-26 21:15:59 -06:00
Hagai Kariti
7fcfc7450d Don't template play vars by themselves, it's too early 2014-11-26 21:15:43 -06:00
James Cammarata
dece0c3f08 Version bump for 1.8.0 2014-11-25 15:58:28 -06:00
James Cammarata
672a2cc037 Locking submodule SHAs for 1.8.0 2014-11-25 15:51:42 -06:00
16 changed files with 54 additions and 23 deletions

View file

@ -1,7 +1,14 @@
Ansible Changes By Release Ansible Changes By Release
========================== ==========================
## 1.8 "You Really Got Me" - Active Development ## 1.8.1 "You Really Got Me" - Nov 26, 2014
* Various bug fixes in postgresql and mysql modules.
* Fixed a bug related to lookup plugins used within roles not finding files based on the relative paths to the roles files/ directory.
* Fixed a bug related to vars specified in plays being templated too early, resulting in incorrect variable interpolation.
* Fixed a bug related to git submodules in bare repos.
## 1.8 "You Really Got Me" - Nov 25, 2014
Major changes: Major changes:

View file

@ -7,3 +7,5 @@ recursive-include docs *
include Makefile include Makefile
include VERSION include VERSION
include MANIFEST.in include MANIFEST.in
prune lib/ansible/modules/core/.git
prune lib/ansible/modules/extras/.git

View file

@ -4,11 +4,13 @@ Ansible Releases at a Glance
Active Development Active Development
++++++++++++++++++ ++++++++++++++++++
1.8 "You Really Got Me" ---- FALL 2014 1.9 "Dancing In the Streets" WINTER 2015
Released Released
++++++++ ++++++++
1.8.1 "You Really Got Me" ---- 11-26-2014
1.8 "You Really Got Me" ---- 11-25-2014
1.7.2 "Summer Nights" -------- 09-24-2014 1.7.2 "Summer Nights" -------- 09-24-2014
1.7.1 "Summer Nights" -------- 08-14-2014 1.7.1 "Summer Nights" -------- 08-14-2014
1.7 "Summer Nights" -------- 08-06-2014 1.7 "Summer Nights" -------- 08-06-2014

View file

@ -1 +1 @@
1.8 1.8.1

View file

@ -14,5 +14,5 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
__version__ = '1.8' __version__ = '1.8.1'
__author__ = 'Michael DeHaan' __author__ = 'Michael DeHaan'

@ -1 +1 @@
Subproject commit 10ebcccedb542c7e1c499e77a1f53da98d373bc3 Subproject commit dd4095137a00b1ddec1de5fe21495a28be0b9f03

@ -1 +1 @@
Subproject commit 317654dba5cae905b5d6eed78f5c6c6984cc2f02 Subproject commit cf54dc46b49adfccf377d646727d922cf7c7d659

View file

@ -88,13 +88,6 @@ class Play(object):
if self.playbook.inventory.src() is not None: if self.playbook.inventory.src() is not None:
load_vars['inventory_file'] = self.playbook.inventory.src() load_vars['inventory_file'] = self.playbook.inventory.src()
# template the play vars with themselves and the extra vars
# from the playbook, to make sure they're correct
all_vars = utils.combine_vars(self.vars, self.playbook.extra_vars)
all_vars = utils.combine_vars(all_vars, load_vars)
self.vars = template(basedir, self.vars, all_vars)
self.vars = utils.combine_vars(self.vars, load_vars)
# We first load the vars files from the datastructure # We first load the vars files from the datastructure
# so we have the default variables to pass into the roles # so we have the default variables to pass into the roles
self.vars_files = ds.get('vars_files', []) self.vars_files = ds.get('vars_files', [])

View file

@ -50,7 +50,7 @@ class LookupModule(object):
if isinstance(term, basestring): if isinstance(term, basestring):
# convert a variable to a list # convert a variable to a list
term2 = utils.listify_lookup_plugin_terms(term, self.basedir, inject, fail_on_undefined=False) term2 = utils.listify_lookup_plugin_terms(term, self.basedir, inject)
# but avoid converting a plain string to a list of one string # but avoid converting a plain string to a list of one string
if term2 != [ term ]: if term2 != [ term ]:
term = term2 term = term2
@ -59,7 +59,7 @@ class LookupModule(object):
# if it's a list, check recursively for items that are a list # if it's a list, check recursively for items that are a list
term = self.flatten(term, inject) term = self.flatten(term, inject)
ret.extend(term) ret.extend(term)
else: else:
ret.append(term) ret.append(term)
return ret return ret

View file

@ -1451,7 +1451,7 @@ def safe_eval(expr, locals={}, include_exceptions=False):
return expr return expr
def listify_lookup_plugin_terms(terms, basedir, inject, fail_on_undefined=C.DEFAULT_UNDEFINED_VAR_BEHAVIOR): def listify_lookup_plugin_terms(terms, basedir, inject):
from ansible.utils import template from ansible.utils import template
@ -1469,11 +1469,13 @@ def listify_lookup_plugin_terms(terms, basedir, inject, fail_on_undefined=C.DEFA
# if not already a list, get ready to evaluate with Jinja2 # if not already a list, get ready to evaluate with Jinja2
# not sure why the "/" is in above code :) # not sure why the "/" is in above code :)
try: try:
new_terms = template.template(basedir, "{{%s}}" % terms, inject, convert_bare=True, fail_on_undefined=fail_on_undefined) new_terms = template.template(basedir, terms, inject, convert_bare=True, fail_on_undefined=C.DEFAULT_UNDEFINED_VAR_BEHAVIOR)
if isinstance(new_terms, basestring) and "{{" in new_terms: if isinstance(new_terms, basestring) and "{{" in new_terms:
pass pass
else: else:
terms = new_terms terms = new_terms
except errors.AnsibleUndefinedVariable:
raise
except jinja2.exceptions.UndefinedError, e: except jinja2.exceptions.UndefinedError, e:
raise errors.AnsibleUndefinedVariable('undefined variable in items: %s' % e) raise errors.AnsibleUndefinedVariable('undefined variable in items: %s' % e)
except: except:

View file

@ -86,12 +86,14 @@ JINJA2_ALLOWED_OVERRIDES = ['trim_blocks', 'lstrip_blocks', 'newline_sequence',
def lookup(name, *args, **kwargs): def lookup(name, *args, **kwargs):
from ansible import utils from ansible import utils
instance = utils.plugins.lookup_loader.get(name.lower(), basedir=kwargs.get('basedir',None)) instance = utils.plugins.lookup_loader.get(name.lower(), basedir=kwargs.get('basedir',None))
vars = kwargs.get('vars', None) tvars = kwargs.get('vars', None)
if instance is not None: if instance is not None:
# safely catch run failures per #5059 # safely catch run failures per #5059
try: try:
ran = instance.run(*args, inject=vars, **kwargs) ran = instance.run(*args, inject=tvars, **kwargs)
except errors.AnsibleUndefinedVariable:
raise
except Exception, e: except Exception, e:
ran = None ran = None
if ran: if ran:

View file

@ -1,8 +1,14 @@
ansible (1.8) unstable; urgency=low ansible (1.8.1) unstable; urgency=low
* 1.8 release (PENDING) * 1.8.1
-- Michael DeHaan <michael@ansible.com> Wed, 21 Oct 2015 04:29:00 -0500 -- Michael DeHaan <michael@ansible.com> Wed, 26 Nov 2014 23:00:00 -0500
ansible (1.8.0) unstable; urgency=low
* 1.8.0
-- Michael DeHaan <michael@ansible.com> Tue, 25 Nov 2014 17:00:00 -0500
ansible (1.7.2) unstable; urgency=low ansible (1.7.2) unstable; urgency=low

View file

@ -110,6 +110,12 @@ rm -rf %{buildroot}
%changelog %changelog
* Wed Nov 26 2014 Michael DeHaan <michael@ansible.com> - 1.8.1
- Release 1.8.1
* Tue Nov 25 2014 Michael DeHaan <michael@ansible.com> - 1.8.0
- Release 1.8.0
* Wed Sep 24 2014 Michael DeHaan <michael@ansible.com> - 1.7.2 * Wed Sep 24 2014 Michael DeHaan <michael@ansible.com> - 1.7.2
- Release 1.7.2 - Release 1.7.2

View file

@ -57,7 +57,7 @@ test_hash:
ANSIBLE_HASH_BEHAVIOUR=merge ansible-playbook test_hash.yml -i $(INVENTORY) $(CREDENTIALS_ARG) -v -e '{"test_hash":{"extra_args":"this is an extra arg"}}' ANSIBLE_HASH_BEHAVIOUR=merge ansible-playbook test_hash.yml -i $(INVENTORY) $(CREDENTIALS_ARG) -v -e '{"test_hash":{"extra_args":"this is an extra arg"}}'
test_var_precedence: test_var_precedence:
ansible-playbook test_var_precedence.yml -i $(INVENTORY) $(CREDENTIALS_ARG) -v -e 'extra_var=extra_var' ansible-playbook test_var_precedence.yml -i $(INVENTORY) $(CREDENTIALS_ARG) -v -e 'extra_var=extra_var' -e 'extra_var_override=extra_var_override'
test_vault: test_vault:
ansible-playbook test_vault.yml -i $(INVENTORY) $(CREDENTIALS_ARG) -v $(TEST_FLAGS) --vault-password-file $(VAULT_PASSWORD_FILE) --list-tasks ansible-playbook test_vault.yml -i $(INVENTORY) $(CREDENTIALS_ARG) -v $(TEST_FLAGS) --vault-password-file $(VAULT_PASSWORD_FILE) --list-tasks

View file

@ -9,6 +9,10 @@ testhost2 ansible_ssh_host=127.0.0.1 ansible_connection=local
[inven_overridehosts] [inven_overridehosts]
invenoverride ansible_ssh_host=127.0.0.1 ansible_connection=local invenoverride ansible_ssh_host=127.0.0.1 ansible_connection=local
[all:vars]
extra_var_override=FROM_INVENTORY
inven_var=inventory_var
[inven_overridehosts:vars] [inven_overridehosts:vars]
foo=foo foo=foo
var_dir=vars var_dir=vars

View file

@ -4,6 +4,8 @@
- vars_var: "vars_var" - vars_var: "vars_var"
- param_var: "BAD!" - param_var: "BAD!"
- vars_files_var: "BAD!" - vars_files_var: "BAD!"
- extra_var_override_once_removed: "{{ extra_var_override }}"
- from_inventory_once_removed: "{{ inven_var | default('BAD!') }}"
vars_files: vars_files:
- vars/test_var_precedence.yml - vars/test_var_precedence.yml
roles: roles:
@ -15,17 +17,22 @@
- name: use set_fact to override the registered_var - name: use set_fact to override the registered_var
set_fact: registered_var="this is from set_fact" set_fact: registered_var="this is from set_fact"
- debug: var=extra_var - debug: var=extra_var
- debug: var=extra_var_override_once_removed
- debug: var=vars_var - debug: var=vars_var
- debug: var=vars_files_var - debug: var=vars_files_var
- debug: var=vars_files_var_role - debug: var=vars_files_var_role
- debug: var=registered_var - debug: var=registered_var
- debug: var=from_inventory_once_removed
- assert: - assert:
that: that:
- 'extra_var == "extra_var"' - 'extra_var == "extra_var"'
- 'extra_var_override == "extra_var_override"'
- 'extra_var_override_once_removed == "extra_var_override"'
- 'vars_var == "vars_var"' - 'vars_var == "vars_var"'
- 'vars_files_var == "vars_files_var"' - 'vars_files_var == "vars_files_var"'
- 'vars_files_var_role == "vars_files_var_role3"' - 'vars_files_var_role == "vars_files_var_role3"'
- 'registered_var == "this is from set_fact"' - 'registered_var == "this is from set_fact"'
- 'from_inventory_once_removed == "inventory_var"'
- hosts: inven_overridehosts - hosts: inven_overridehosts
vars_files: vars_files: