Do not consider an empty version string as a version (#41044)
When using an empty string as the version argument, the module would before attempt to run something akin to: pip install module=="" This changes the behavior to: pip install module Fixes #41043
This commit is contained in:
parent
63d993e07f
commit
828e33f419
2 changed files with 15 additions and 1 deletions
|
@ -219,7 +219,7 @@ def _get_cmd_options(module, cmd):
|
|||
|
||||
|
||||
def _get_full_name(name, version=None):
|
||||
if version is None:
|
||||
if version is None or version == "":
|
||||
resp = name
|
||||
else:
|
||||
resp = name + '==' + version
|
||||
|
|
|
@ -256,3 +256,17 @@
|
|||
assert:
|
||||
that:
|
||||
- not pip_install_empty.changed
|
||||
|
||||
# https://github.com/ansible/ansible/issues/41043
|
||||
- name: do not consider an empty string as a version
|
||||
pip:
|
||||
name: q
|
||||
state: present
|
||||
version: ""
|
||||
virtualenv: "{{ output_dir }}/pipenv"
|
||||
register: pip_install_empty_version_string
|
||||
|
||||
- name: ensure that task installation did not fail
|
||||
assert:
|
||||
that:
|
||||
- pip_install_empty_version_string is successful
|
||||
|
|
Loading…
Reference in a new issue