only validate extensions when using dir loading
fixes #18223
(cherry picked from commit 32a7b4ce71
)
This commit is contained in:
parent
06599f49eb
commit
5c4a4703d9
1 changed files with 3 additions and 3 deletions
|
@ -226,7 +226,7 @@ class ActionModule(ActionBase):
|
||||||
return success
|
return success
|
||||||
return success
|
return success
|
||||||
|
|
||||||
def _load_files(self, filename):
|
def _load_files(self, filename, validate_extensions=False):
|
||||||
""" Loads a file and converts the output into a valid Python dict.
|
""" Loads a file and converts the output into a valid Python dict.
|
||||||
Args:
|
Args:
|
||||||
filename (str): The source file.
|
filename (str): The source file.
|
||||||
|
@ -237,7 +237,7 @@ class ActionModule(ActionBase):
|
||||||
results = dict()
|
results = dict()
|
||||||
failed = False
|
failed = False
|
||||||
err_msg = ''
|
err_msg = ''
|
||||||
if not self._is_valid_file_ext(filename):
|
if validate_extensions and not self._is_valid_file_ext(filename):
|
||||||
failed = True
|
failed = True
|
||||||
err_msg = (
|
err_msg = (
|
||||||
'{0} does not have a valid extension: {1}'
|
'{0} does not have a valid extension: {1}'
|
||||||
|
@ -287,7 +287,7 @@ class ActionModule(ActionBase):
|
||||||
|
|
||||||
if not stop_iter and not failed:
|
if not stop_iter and not failed:
|
||||||
if path.exists(filepath) and not self._ignore_file(filename):
|
if path.exists(filepath) and not self._ignore_file(filename):
|
||||||
failed, err_msg, loaded_data = self._load_files(filepath)
|
failed, err_msg, loaded_data = self._load_files(filepath, validate_extensions=True)
|
||||||
if not failed:
|
if not failed:
|
||||||
results.update(loaded_data)
|
results.update(loaded_data)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue