Backport of pmrun.py: Recreate the older behavior where the entire success command was quoted (#67241)

* pmrun - quote success command (#66929)

* Recreate the older behavior where the entire success command was quoted

* Use shlex_quote for a correct fix of this

* Add changelog fragment

(cherry picked from commit fd8eb77cc3)

* Backport of 66929-pmrun-quote-entire-success-command-string

* Update changelog fragment

* Delete 66929-pmrun-quote-entire-success-command-string.yml

Unclear from docs, but this is the devel fragment so removing.

* Update changelog
pull/67297/head
Allen Smith 5 years ago committed by GitHub
parent 182831d8b0
commit 7ace25dd6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- pmrun plugin - The success command string was no longer quoted. This caused unusual use-cases like ``become_flags=su - root -c`` to fail.

@ -57,6 +57,7 @@ DOCUMENTATION = """
"""
from ansible.plugins.become import BecomeBase
from ansible.module_utils.six.moves import shlex_quote
class BecomeModule(BecomeBase):
@ -72,4 +73,4 @@ class BecomeModule(BecomeBase):
become = self.get_option('become_exe') or self.name
flags = self.get_option('become_flags') or ''
return '%s %s %s' % (become, flags, self._build_success_command(cmd, shell))
return '%s %s %s' % (become, flags, shlex_quote(self._build_success_command(cmd, shell)))

Loading…
Cancel
Save