From 77be724913fa64a956a33b637fead862102248c2 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Tue, 23 May 2017 15:48:53 -0400 Subject: [PATCH] fixed extension matching and name is valid for all --- lib/ansible/plugins/action/include_vars.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/ansible/plugins/action/include_vars.py b/lib/ansible/plugins/action/include_vars.py index 76e25e9b7f..94068a28ea 100644 --- a/lib/ansible/plugins/action/include_vars.py +++ b/lib/ansible/plugins/action/include_vars.py @@ -33,7 +33,8 @@ class ActionModule(ActionBase): VALID_FILE_EXTENSIONS = ['yaml', 'yml', 'json'] VALID_DIR_ARGUMENTS = ['dir', 'depth', 'files_matching', 'ignore_files', 'extensions'] - VALID_FILE_ARGUMENTS = ['file', '_raw_params', 'name'] + VALID_FILE_ARGUMENTS = ['file', '_raw_params'] + VALID_ALL = ['name'] def _set_dir_defaults(self): if not self.depth: @@ -92,6 +93,8 @@ class ActionModule(ActionBase): dirs += 1 elif arg in self.VALID_FILE_ARGUMENTS: files += 1 + elif arg in self.VALID_ALL: + pass else: raise AnsibleError('{0} is not a valid option in debug'.format(arg)) @@ -205,7 +208,8 @@ class ActionModule(ActionBase): Bool """ file_ext = path.splitext(source_file) - return bool(len(file_ext) > 1 and file_ext[-1] in self.valid_extensions) + print(file_ext[-1][2:]) + return bool(len(file_ext) > 1 and file_ext[-1][1:] in self.valid_extensions) def _load_files(self, filename, validate_extensions=False): """ Loads a file and converts the output into a valid Python dict.