include_vars - fix stack trace when run ad-hoc with dirs parameter (#66581)

Add integration test

There are a number of other parameters that result in stack traces as well when this module is used ad-hoc. I'm not sure if we're interested in fixing them all since this module isn't meant to be run ad-hoc.
pull/66875/head
Sam Doran 5 years ago committed by ansibot
parent 3f16752ed2
commit cc2376b782

@ -0,0 +1,2 @@
bugfixes:
- include_vars - fix stack trace when passing ``dirs`` in an ad-hoc command (https://github.com/ansible/ansible/issues/62633)

@ -158,10 +158,11 @@ class ActionModule(ActionBase):
)
self.source_dir = path_to_use
else:
current_dir = (
"/".join(self._task._ds._data_source.split('/')[:-1])
)
self.source_dir = path.join(current_dir, self.source_dir)
if hasattr(self._task._ds, '_data_source'):
current_dir = (
"/".join(self._task._ds._data_source.split('/')[:-1])
)
self.source_dir = path.join(current_dir, self.source_dir)
def _traverse_dir_depth(self):
""" Recursively iterate over a directory and sort the files in

@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -eux
ansible testhost -i ../../inventory -m include_vars -a 'dir/inc.yml' "$@"
ansible testhost -i ../../inventory -m include_vars -a 'dir=dir' "$@"
Loading…
Cancel
Save