diff options
| author | Stefano Rivera <stefanor@debian.org> | 2023-08-04 14:00:58 +0300 |
|---|---|---|
| committer | git-ubuntu importer <ubuntu-devel-discuss@lists.ubuntu.com> | 2023-08-04 16:34:37 +0000 |
| commit | 09c2f103457b9a0cfc88718f324b49c08207b904 (patch) | |
| tree | b077361453acc4809479d73c6035ac9ce31fa4b7 | |
| parent | f415c87314a09d38dde073aea6823b8f6361f472 (diff) | |
0.3.4-2 (patches unapplied)import/0.3.4-2ubuntu/mantic-proposedubuntu/mantic-develubuntu/mantic
Imported using git-ubuntu import.
Notes
Notes:
* Patch: Fix --ask-become-pass, again. We had backed out part of the
ansible-6 patch to avoid this, before, but it came back in 0.3.4,
upstream. (Closes: #1042556)
| -rw-r--r-- | debian/changelog | 8 | ||||
| -rw-r--r-- | debian/patches/ask-become-pass | 189 | ||||
| -rw-r--r-- | debian/patches/series | 1 |
3 files changed, 198 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index fd60c42..545af8d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +python-mitogen (0.3.4-2) unstable; urgency=medium + + * Patch: Fix --ask-become-pass, again. We had backed out part of the + ansible-6 patch to avoid this, before, but it came back in 0.3.4, + upstream. (Closes: #1042556) + + -- Stefano Rivera <stefanor@debian.org> Fri, 04 Aug 2023 14:00:58 +0300 + python-mitogen (0.3.4-1) unstable; urgency=medium * New upstream release. diff --git a/debian/patches/ask-become-pass b/debian/patches/ask-become-pass new file mode 100644 index 0000000..2130532 --- /dev/null +++ b/debian/patches/ask-become-pass @@ -0,0 +1,189 @@ +From: Alex Willmer <alex@moreati.org.uk> +Date: Fri, 7 Jul 2023 21:32:02 +0100 +Subject: ansible_mitogen: Fix --ask-become-pass, add test coverage + +Previously f1503874de82353cbed8b51408d20fdfa899f8f7 fixed the priority of +ansible_become_pass over ansible_become_password, but broke --ask-become-pass. +Fixes #952. + +Origin: upstream, https://github.com/mitogen-hq/mitogen/pull/1007 +Bug-Debian: https://bugs.debian.org/1042556 +--- + .ci/ansible_tests.py | 11 ++++++++++- + ansible_mitogen/transport_config.py | 16 ++++++++++++---- + tests/ansible/hosts/default.hosts | 2 ++ + tests/ansible/hosts/transport_config.hosts | 2 +- + .../integration/transport_config/become_pass.yml | 5 +++-- + tests/ansible/regression/all.yml | 1 + + tests/ansible/regression/become_test.yml | 9 +++++++++ + .../regression/issue_952__ask_become_pass.yml | 21 +++++++++++++++++++++ + tests/requirements.txt | 1 + + 9 files changed, 60 insertions(+), 8 deletions(-) + create mode 100644 tests/ansible/regression/become_test.yml + create mode 100644 tests/ansible/regression/issue_952__ask_become_pass.yml + +diff --git a/.ci/ansible_tests.py b/.ci/ansible_tests.py +index 43d4f4c..0dd978c 100755 +--- a/.ci/ansible_tests.py ++++ b/.ci/ansible_tests.py +@@ -6,6 +6,7 @@ import glob + import os + import signal + import sys ++import textwrap + + import ci_lib + +@@ -74,7 +75,15 @@ with ci_lib.Fold('job_setup'): + fp.write('\n[%s]\n' % family) + fp.writelines('%s\n' % name for name in hostnames) + +- fp.write('\n[linux:children]\ntest-targets\n') ++ fp.write(textwrap.dedent( ++ ''' ++ [linux:children] ++ test-targets ++ ++ [linux_containers:children] ++ test-targets ++ ''' ++ )) + + ci_lib.dump_file(inventory_path) + +diff --git a/ansible_mitogen/transport_config.py b/ansible_mitogen/transport_config.py +index 5fc7818..1fc1e80 100644 +--- a/ansible_mitogen/transport_config.py ++++ b/ansible_mitogen/transport_config.py +@@ -79,7 +79,6 @@ try: + except ImportError: + from ansible.vars.unsafe_proxy import AnsibleUnsafeText + +-import ansible_mitogen.loaders + import mitogen.core + + +@@ -436,9 +435,18 @@ class PlayContextSpec(Spec): + return self._play_context.become_user + + def become_pass(self): +- become_method = self.become_method() +- become_plugin = ansible_mitogen.loaders.become_loader.get(become_method) +- become_pass = become_plugin.get_option('become_pass', hostvars=self._task_vars) ++ # become_pass is owned/provided by the active become plugin. However ++ # PlayContext is intertwined with it. Known complications ++ # - ansible_become_password is higher priority than ansible_become_pass, ++ # `play_context.become_pass` doesn't obey this (atleast with Mitgeon). ++ # - `meta: reset_connection` runs `connection.reset()` but ++ # `ansible_mitogen.connection.Connection.reset()` recreates the ++ # connection object, setting `connection.become = None`. ++ become_plugin = self._connection.become ++ try: ++ become_pass = become_plugin.get_option('become_pass', playcontext=self._play_context) ++ except AttributeError: ++ become_pass = self._play_context.become_pass + return optional_secret(become_pass) + + def password(self): +diff --git a/tests/ansible/hosts/default.hosts b/tests/ansible/hosts/default.hosts +index d40c3dd..7ef231b 100644 +--- a/tests/ansible/hosts/default.hosts ++++ b/tests/ansible/hosts/default.hosts +@@ -7,3 +7,5 @@ target ansible_host=localhost ansible_user="{{lookup('env', 'USER')}}" + + [test-targets] + target ++ ++[linux_containers] +diff --git a/tests/ansible/hosts/transport_config.hosts b/tests/ansible/hosts/transport_config.hosts +index 7d7b526..d6a15c9 100644 +--- a/tests/ansible/hosts/transport_config.hosts ++++ b/tests/ansible/hosts/transport_config.hosts +@@ -21,7 +21,7 @@ tc_transport + # That causes approx 10 seconds timeout per task - there's no host to connect to. + # This optimisation should not be relied in any test. + # Note: tc-python-path-* are intentionally not included. +-ansible_python_interpreter = python3000 # Not expected to exist ++ansible_python_interpreter = python3000 + + [tc_transport] + tc-transport-unset +diff --git a/tests/ansible/integration/transport_config/become_pass.yml b/tests/ansible/integration/transport_config/become_pass.yml +index 317e052..670faf5 100644 +--- a/tests/ansible/integration/transport_config/become_pass.yml ++++ b/tests/ansible/integration/transport_config/become_pass.yml +@@ -129,8 +129,9 @@ + - out.result|length == 2 + - out.result[0].method == "ssh" + - out.result[1].method == "sudo" +- # Ansible >= 2.10 builtin become plugins (e.g. sudo, su) give priority +- # to ansible_become_pass over ansible_become_password. ++ # Ansible <= 2.9.1 prioritises ansible_become_password. ++ # Ansible >= 2.9.2 prioritises ansible_become_pass. ++ # https://github.com/ansible/ansible/commit/480b106d6535978ae6ecab68b40942ca4fa914a0 + - out.result[1].kwargs.password == "bpass" + fail_msg: out={{out}} + +diff --git a/tests/ansible/regression/all.yml b/tests/ansible/regression/all.yml +index 0e59947..477cacc 100644 +--- a/tests/ansible/regression/all.yml ++++ b/tests/ansible/regression/all.yml +@@ -14,3 +14,4 @@ + - import_playbook: issue_615__streaming_transfer.yml + - import_playbook: issue_655__wait_for_connection_error.yml + - import_playbook: issue_776__load_plugins_called_twice.yml ++- import_playbook: issue_952__ask_become_pass.yml +diff --git a/tests/ansible/regression/become_test.yml b/tests/ansible/regression/become_test.yml +new file mode 100644 +index 0000000..5af2e12 +--- /dev/null ++++ b/tests/ansible/regression/become_test.yml +@@ -0,0 +1,9 @@ ++- name: regression/become_test.yml ++ hosts: test-targets:&linux_containers ++ become: true ++ become_user: mitogen__pw_required ++ strategy: mitogen_linear ++ tasks: ++ - command: whoami ++ changed_when: false ++ check_mode: false +diff --git a/tests/ansible/regression/issue_952__ask_become_pass.yml b/tests/ansible/regression/issue_952__ask_become_pass.yml +new file mode 100644 +index 0000000..da269e2 +--- /dev/null ++++ b/tests/ansible/regression/issue_952__ask_become_pass.yml +@@ -0,0 +1,21 @@ ++- name: regression/issue_952__ask_become_pass.yml ++ hosts: test-targets[0]:&linux_containers ++ gather_facts: false ++ tags: ++ - issue_952 ++ tasks: ++ - name: Test --ask-become-pass ++ delegate_to: localhost ++ expect: ++ command: > ++ ansible-playbook ++ {% for inv in ansible_inventory_sources %} ++ -i "{{ inv }}" ++ {% endfor %} ++ --ask-become-pass ++ regression/become_test.yml ++ chdir: ../ ++ responses: ++ 'BECOME password:': pw_required_password ++ changed_when: false ++ check_mode: false +diff --git a/tests/requirements.txt b/tests/requirements.txt +index 7301bee..eb84b9b 100644 +--- a/tests/requirements.txt ++++ b/tests/requirements.txt +@@ -3,6 +3,7 @@ coverage==5.5; python_version < '3.7' + coverage==6.4.4; python_version >= '3.7' + Django==1.6.11 # Last version supporting 2.6. + mock==2.0.0 ++pexpect==4.8 + pytz==2018.5 + cffi==1.14.3 # Random pin to try and fix pyparser==2.18 not having effect + pycparser==2.18 # Last version supporting 2.6. diff --git a/debian/patches/series b/debian/patches/series index be72e03..a396974 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -6,3 +6,4 @@ skip-python2.7-test poll-poller no-subprocess32 ansible-2.14 +ask-become-pass |
