summaryrefslogtreecommitdiff
path: root/lib/ansible/plugins/lookup/pipe.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ansible/plugins/lookup/pipe.py')
-rw-r--r--lib/ansible/plugins/lookup/pipe.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/ansible/plugins/lookup/pipe.py b/lib/ansible/plugins/lookup/pipe.py
index 54df3fc0..20e922b6 100644
--- a/lib/ansible/plugins/lookup/pipe.py
+++ b/lib/ansible/plugins/lookup/pipe.py
@@ -24,6 +24,7 @@ DOCUMENTATION = r"""
It is strongly recommended to pass user input or variable input via quote filter before using with pipe lookup.
See example section for this.
Read more about this L(Bandit B602 docs,https://bandit.readthedocs.io/en/latest/plugins/b602_subprocess_popen_with_shell_equals_true.html)
+ - The directory of the play is used as the current working directory.
"""
EXAMPLES = r"""
@@ -56,15 +57,13 @@ class LookupModule(LookupBase):
ret = []
for term in terms:
- '''
- https://docs.python.org/3/library/subprocess.html#popen-constructor
-
- The shell argument (which defaults to False) specifies whether to use the
- shell as the program to execute. If shell is True, it is recommended to pass
- args as a string rather than as a sequence
-
- https://github.com/ansible/ansible/issues/6550
- '''
+ # https://docs.python.org/3/library/subprocess.html#popen-constructor
+ #
+ # The shell argument (which defaults to False) specifies whether to use the
+ # shell as the program to execute. If shell is True, it is recommended to pass
+ # args as a string rather than as a sequence
+ #
+ # https://github.com/ansible/ansible/issues/6550
term = str(term)
p = subprocess.Popen(term, cwd=self._loader.get_basedir(), shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)