mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00: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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user