diff options
author | Toshio Kuratomi <toshio@fedoraproject.org> | 2015-02-02 14:12:16 -0800 |
---|---|---|
committer | James Cammarata <jimi@sngx.net> | 2015-02-17 14:03:39 -0600 |
commit | d615f2a076b598a73f83558dac6a3fef006110fc (patch) | |
tree | 20e8f51f082c29666d60ef838b0b58ee1b65a29d | |
parent | ad6183a322e00f7b9d751cd02d608b804ef79a91 (diff) | |
download | ansible-d615f2a076b598a73f83558dac6a3fef006110fc.tar.gz |
Fix for v1 handling of unicode extra-vars
-rwxr-xr-x | bin/ansible-playbook | 6 | ||||
-rw-r--r-- | test/integration/Makefile | 2 | ||||
-rw-r--r-- | test/integration/unicode.yml | 4 |
3 files changed, 9 insertions, 3 deletions
diff --git a/bin/ansible-playbook b/bin/ansible-playbook index 96e87de3eb..17c1153fc2 100755 --- a/bin/ansible-playbook +++ b/bin/ansible-playbook @@ -39,6 +39,7 @@ import ansible.utils.template from ansible import errors from ansible import callbacks from ansible import utils +from ansible.utils import to_unicode from ansible.color import ANSIBLE_COLOR, stringc from ansible.callbacks import display @@ -136,10 +137,11 @@ def main(args): extra_vars = {} for extra_vars_opt in options.extra_vars: - if extra_vars_opt.startswith("@"): + extra_vars_opt = to_unicode(extra_vars_opt) + if extra_vars_opt.startswith(u"@"): # Argument is a YAML file (JSON is a subset of YAML) extra_vars = utils.combine_vars(extra_vars, utils.parse_yaml_from_file(extra_vars_opt[1:], vault_password=vault_pass)) - elif extra_vars_opt and extra_vars_opt[0] in '[{': + elif extra_vars_opt and extra_vars_opt[0] in u'[{': # Arguments as YAML extra_vars = utils.combine_vars(extra_vars, utils.parse_yaml(extra_vars_opt)) else: diff --git a/test/integration/Makefile b/test/integration/Makefile index fc973e368f..5f6d04fc56 100644 --- a/test/integration/Makefile +++ b/test/integration/Makefile @@ -33,7 +33,7 @@ includes: ansible-playbook test_includes.yml -i $(INVENTORY) -e @$(VARS_FILE) $(CREDENTIALS_ARG) $(TEST_FLAGS) unicode: - ansible-playbook unicode.yml -i $(INVENTORY) -e @$(VARS_FILE) -v $(TEST_FLAGS) + ansible-playbook unicode.yml -i $(INVENTORY) -e @$(VARS_FILE) -v $(TEST_FLAGS) -e 'extra_var=café' # Test the start-at-task flag #9571 ansible-playbook unicode.yml -i $(INVENTORY) -e @$(VARS_FILE) -v --start-at-task '*¶' -e 'start_at_task=True' $(TEST_FLAGS) diff --git a/test/integration/unicode.yml b/test/integration/unicode.yml index 60fb14214b..4e7fe635f4 100644 --- a/test/integration/unicode.yml +++ b/test/integration/unicode.yml @@ -35,6 +35,10 @@ host_id: '{{item}}' with_sequence: start=1 end={{num_hosts}} format=%d + - name: 'A task with unicode extra vars' + debug: var=extra_var + + - name: 'A play for hosts in group: ĪīĬĭ' hosts: 'ĪīĬĭ' gather_facts: true |