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

dont merge extra vars data if none

fixes #21889
This commit is contained in:
Brian Coca 2017-02-27 09:06:31 -05:00 committed by Brian Coca
parent bfb3467d52
commit e0975602d1

View file

@ -20,7 +20,6 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import ast import ast
import os
import random import random
import uuid import uuid
@ -120,6 +119,7 @@ def merge_hash(a, b):
def load_extra_vars(loader, options): def load_extra_vars(loader, options):
extra_vars = {} extra_vars = {}
for extra_vars_opt in options.extra_vars: for extra_vars_opt in options.extra_vars:
data = None
extra_vars_opt = to_text(extra_vars_opt, errors='surrogate_or_strict') extra_vars_opt = to_text(extra_vars_opt, errors='surrogate_or_strict')
if extra_vars_opt.startswith(u"@"): if extra_vars_opt.startswith(u"@"):
# Argument is a YAML file (JSON is a subset of YAML) # Argument is a YAML file (JSON is a subset of YAML)
@ -130,7 +130,10 @@ def load_extra_vars(loader, options):
else: else:
# Arguments as Key-value # Arguments as Key-value
data = parse_kv(extra_vars_opt) data = parse_kv(extra_vars_opt)
extra_vars = combine_vars(extra_vars, data)
if data is not None:
extra_vars = combine_vars(extra_vars, data)
return extra_vars return extra_vars