1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Make extra_vars into unicode string type early

Fixes v2 for #10106
This commit is contained in:
Toshio Kuratomi 2015-02-02 13:58:21 -08:00
parent 6d788629a2
commit 1ed1af6cb4

View file

@ -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: