Revert potential incorrect fix for forcereinstall, add changelog fragment

pull/81816/head
Davide Sbetti 1 year ago
parent 2c8c4e5927
commit b4734a956c

@ -0,0 +1,2 @@
bugfixes:
- pip - Incorrect changed status was returned in case of installation from VCS where the target commit was different but the version was the same. The fix now evaluates also the commits used for installation from VCS (https://github.com/ansible/ansible/issues/81751).

@ -800,7 +800,7 @@ def main():
)
if module.check_mode:
if extra_args or requirements or state == 'latest' or not name or state == "forcereinstall":
if extra_args or requirements or state == 'latest' or not name:
module.exit_json(changed=True)
pkg_cmd, out_pip, err_pip = _get_packages(module, pip, chdir)
@ -850,7 +850,7 @@ def main():
changed = 'Successfully installed' in out_pip
else:
dummy, out_freeze_after, dummy = _get_packages(module, pip, chdir)
changed = out_freeze_before != out_freeze_after or state == "forcereinstall"
changed = out_freeze_before != out_freeze_after
changed = changed or venv_created

@ -63,31 +63,6 @@
- command: "{{ ansible_python.executable }} -c 'import {{ item }}'"
loop: '{{ pip_test_modules }}'
# force reinstall packages in check mode and ensure we recorded a change
- name: forcereinstall packages in check mode
pip:
name: "{{ pip_test_packages }}"
state: forcereinstall
check_mode: true
register: forcereinstall_result_check_mode
- name: verify we recorded a change
assert:
that:
- "forcereinstall_result_check_mode is changed"
# force reinstall packages for real and ensure we recorded a change
- name: forcereinstall packages
pip:
name: "{{ pip_test_packages }}"
state: forcereinstall
register: forcereinstall_result
- name: verify we recorded a change
assert:
that:
- "forcereinstall_result is changed"
# now remove it to test uninstallation of a package we are sure is installed
- name: now uninstall so we can see that a change occurred

Loading…
Cancel
Save