From f7f5c7f913c50694edfaa1452d9920ccc9fbb2e7 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sat, 2 Aug 2025 18:02:31 +0200 Subject: [PATCH] [stable-9] [stable-10] Disable pipelining for doas and machinectl on ansible-core 2.19+ (#10537) (#10561) (#10565) [stable-10] Disable pipelining for doas and machinectl on ansible-core 2.19+ (#10537) (#10561) Disable pipelining for doas and machinectl on ansible-core 2.19+ (#10537) Disable pipelining for doas and machinectl. (cherry picked from commit 9a29622584c13a0d6139d1959f01b7520adf63e1) (cherry picked from commit 69563766ec33a69bc4cc7bf37d1d71a4df6cc116) --- changelogs/fragments/become-pipelining.yml | 3 +++ plugins/become/doas.py | 7 +++++++ plugins/become/machinectl.py | 6 ++++++ 3 files changed, 16 insertions(+) create mode 100644 changelogs/fragments/become-pipelining.yml diff --git a/changelogs/fragments/become-pipelining.yml b/changelogs/fragments/become-pipelining.yml new file mode 100644 index 0000000000..201d85f71c --- /dev/null +++ b/changelogs/fragments/become-pipelining.yml @@ -0,0 +1,3 @@ +bugfixes: + - "doas become plugin - disable pipelining on ansible-core 2.19+. The plugin does not work with pipelining, and since ansible-core 2.19 become plugins can indicate that they do not work with pipelining (https://github.com/ansible-collections/community.general/issues/9977, https://github.com/ansible-collections/community.general/pull/10537)." + - "machinectl become plugin - disable pipelining on ansible-core 2.19+. The plugin does not work with pipelining, and since ansible-core 2.19 become plugins can indicate that they do not work with pipelining (https://github.com/ansible-collections/community.general/pull/10537)." diff --git a/plugins/become/doas.py b/plugins/become/doas.py index 761e5e1e95..677c4c2273 100644 --- a/plugins/become/doas.py +++ b/plugins/become/doas.py @@ -84,6 +84,9 @@ DOCUMENTATION = ''' - name: ansible_doas_prompt_l10n env: - name: ANSIBLE_DOAS_PROMPT_L10N + notes: + - This become plugin does not work when connection pipelining is enabled. With ansible-core 2.19+, using it automatically + disables pipelining. On ansible-core 2.18 and before, pipelining must explicitly be disabled by the user. ''' import re @@ -100,6 +103,10 @@ class BecomeModule(BecomeBase): fail = ('Permission denied',) missing = ('Authorization required',) + # See https://github.com/ansible-collections/community.general/issues/9977, + # https://github.com/ansible/ansible/pull/78111 + pipelining = False + def check_password_prompt(self, b_output): ''' checks if the expected password prompt exists in b_output ''' diff --git a/plugins/become/machinectl.py b/plugins/become/machinectl.py index a0467c2c36..f01c6f9352 100644 --- a/plugins/become/machinectl.py +++ b/plugins/become/machinectl.py @@ -77,6 +77,8 @@ DOCUMENTATION = ''' if the user is allowed to perform the action (take a look at the examples section). If such a rule is not present the plugin only work if it is used in context with the root user, because then no further prompt will be shown by machinectl. + - This become plugin does not work when connection pipelining is enabled. With ansible-core 2.19+, using it automatically + disables pipelining. On ansible-core 2.18 and before, pipelining must explicitly be disabled by the user. ''' EXAMPLES = r''' @@ -109,6 +111,10 @@ class BecomeModule(BecomeBase): success = ('==== AUTHENTICATION COMPLETE ====',) require_tty = True # see https://github.com/ansible-collections/community.general/issues/6932 + # See https://github.com/ansible/ansible/issues/81254, + # https://github.com/ansible/ansible/pull/78111 + pipelining = False + @staticmethod def remove_ansi_codes(line): return ansi_color_codes.sub(b"", line)