mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
validate vars_files entries are string_type or list (#40985)
* validate vars_files entries are string_type or list Fixes #17594 Signed-off-by: Adam Miller <admiller@redhat.com> * use collections.Sequence to simplify if check Signed-off-by: Adam Miller <admiller@redhat.com>
This commit is contained in:
parent
0d4e113975
commit
c65b7eb52e
1 changed files with 7 additions and 1 deletions
|
@ -22,7 +22,7 @@ __metaclass__ = type
|
|||
import os
|
||||
import sys
|
||||
|
||||
from collections import defaultdict, MutableMapping
|
||||
from collections import defaultdict, MutableMapping, Sequence
|
||||
|
||||
try:
|
||||
from hashlib import sha1
|
||||
|
@ -340,6 +340,12 @@ class VariableManager:
|
|||
try:
|
||||
for vars_file in vars_file_list:
|
||||
vars_file = templar.template(vars_file)
|
||||
if not (isinstance(vars_file, Sequence)):
|
||||
raise AnsibleError(
|
||||
"Invalid vars_files entry found: %r\n"
|
||||
"vars_files entries should be either a string type or "
|
||||
"a list of string types after template expansion" % vars_file
|
||||
)
|
||||
try:
|
||||
data = preprocess_vars(self._loader.load_from_file(vars_file, unsafe=True))
|
||||
if data is not None:
|
||||
|
|
Loading…
Reference in a new issue