mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 22:51:23 -07: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 os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from collections import defaultdict, MutableMapping
|
from collections import defaultdict, MutableMapping, Sequence
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from hashlib import sha1
|
from hashlib import sha1
|
||||||
|
@ -340,6 +340,12 @@ class VariableManager:
|
||||||
try:
|
try:
|
||||||
for vars_file in vars_file_list:
|
for vars_file in vars_file_list:
|
||||||
vars_file = templar.template(vars_file)
|
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:
|
try:
|
||||||
data = preprocess_vars(self._loader.load_from_file(vars_file, unsafe=True))
|
data = preprocess_vars(self._loader.load_from_file(vars_file, unsafe=True))
|
||||||
if data is not None:
|
if data is not None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue