From 1ed1af6cb4f48d679424b109584b22475602c722 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 2 Feb 2015 13:58:21 -0800 Subject: [PATCH] Make extra_vars into unicode string type early Fixes v2 for #10106 --- v2/bin/ansible-playbook | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/v2/bin/ansible-playbook b/v2/bin/ansible-playbook index 543a66dd828..5292b84cce3 100755 --- a/v2/bin/ansible-playbook +++ b/v2/bin/ansible-playbook @@ -13,6 +13,7 @@ from ansible.parsing.splitter import parse_kv from ansible.playbook import Playbook from ansible.playbook.task import Task from ansible.utils.cli import base_parser +from ansible.utils.unicode import to_unicode from ansible.utils.vars import combine_vars from ansible.vars import VariableManager @@ -105,10 +106,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) data = loader.load_from_file(extra_vars_opt[1:]) - elif extra_vars_opt and extra_vars_opt[0] in '[{': + elif extra_vars_opt and extra_vars_opt[0] in u'[{': # Arguments as YAML data = loader.load(extra_vars_opt) else: