From 6d467a8bd97a427f7dcb6e78070a48ca3dd74f54 Mon Sep 17 00:00:00 2001 From: Joseph Date: Tue, 16 Jul 2019 22:40:37 +0100 Subject: [PATCH] Backport machinectl become plugin fixes (#58734) (#58774) * Correct machinectl become plugin function arguments (#58734) * Correct get_option function name and change flags to become_flags * Remove the '--' from the returned command * add changelog fragment * change changelog fragment description * move the -q argument to machinectl before the shell argument to resolve issues with machinectl v230 (see #56571) (cherry picked from commit 4f642daae562b25452e2722ae05beae39866519e) * Update PR number in changelog fragment * Revert "Update PR number in changelog fragment" This reverts commit 38e6b4785a4a13aacf86541a64c4b8e47f52c1d4. --- .../fragments/58734-correct-machinectl-become-plugin.yaml | 2 ++ lib/ansible/plugins/become/machinectl.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 changelogs/fragments/58734-correct-machinectl-become-plugin.yaml diff --git a/changelogs/fragments/58734-correct-machinectl-become-plugin.yaml b/changelogs/fragments/58734-correct-machinectl-become-plugin.yaml new file mode 100644 index 00000000000..77e4955086a --- /dev/null +++ b/changelogs/fragments/58734-correct-machinectl-become-plugin.yaml @@ -0,0 +1,2 @@ +bugfixes: + - machinectl become plugin - correct bugs which induced errors on plugin usage diff --git a/lib/ansible/plugins/become/machinectl.py b/lib/ansible/plugins/become/machinectl.py index 811f9c514ef..4e3a69f73bb 100644 --- a/lib/ansible/plugins/become/machinectl.py +++ b/lib/ansible/plugins/become/machinectl.py @@ -81,7 +81,7 @@ class BecomeModule(BecomeBase): if not cmd: return cmd - become = self._get_option('become_exe') or self.name - flags = self.get_option('flags') or '' + become = self.get_option('become_exe') or self.name + flags = self.get_option('become_flags') or '' user = self.get_option('become_user') or '' - return '%s shell -q %s %s@ %s' % (become, flags, user, cmd) + return '%s -q shell %s %s@ %s' % (become, flags, user, cmd)