Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
Story: As a user, I do not have to worry about pulpcore being acciden…
Browse files Browse the repository at this point in the history
…tally upgraded by plugins requiring other versions

Fixes: #5863
Generate and use a pulpcore constraints file in ansible-pulp

re: #5862
As a user, I do not have to worry about pulpcore being accidentally upgraded by plugins requiring other versions

re: 5890
[Epic] The ansible-pulp installer needs to handle multiple versions of Pulp
  • Loading branch information
mikedep333 committed Jan 14, 2020
1 parent e51fc08 commit 8bb7db2
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions roles/pulp/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,15 @@
virtualenv_command: '{{ pulp_python_interpreter }} -m venv'
when: prereq_pip_packages | length > 0

- name: Install pulpcore package via PyPI
pip:
name: pulpcore
state: present
virtualenv: '{{ pulp_install_dir }}'
virtualenv_command: '{{ pulp_python_interpreter }} -m venv'
when: pulp_source_dir is undefined
notify: Collect static content

- name: Install pulpcore package from source
pip:
name: '{{ pulp_source_dir }}'
Expand All @@ -205,10 +214,25 @@
changed_when: result.changed and not pulp_pip_editable
notify: Collect static content

# We have to do this separate task, even though the pip module should
# register the installed version, because when tested (Ansible 2.9, with no
# changes applied), the registered result from "Install pulpcore package
# from source" left the version field "null".
- name: Obtain list of packages & versions in the venv
pip_package_info:
clients: "{{ pulp_install_dir }}/bin/pip"
register: pip_pkgs

- name: Create constraints file to lock the pulpcore version when plugins are installed
copy:
content: "pulpcore=={{ pip_pkgs.packages[pulp_install_dir + '/bin/pip'].pulpcore[0].version }}\n"
dest: "{{ pulp_install_dir }}/pip_constraints_for_plugins.txt"

- name: Install Pulp plugins via PyPI
pip:
name: '{{ item.key }}'
state: present
extra_args: "-c {{ pulp_install_dir }}/pip_constraints_for_plugins.txt"
virtualenv: '{{ pulp_install_dir }}'
virtualenv_command: '{{ pulp_python_interpreter }} -m venv'
with_dict: '{{ pulp_install_plugins }}'
Expand All @@ -220,6 +244,7 @@
name: '{{ item.value.source_dir }}'
editable: '{{ pulp_pip_editable }}'
state: present
extra_args: "-c {{ pulp_install_dir }}/pip_constraints_for_plugins.txt"
virtualenv: '{{ pulp_install_dir }}'
virtualenv_command: '{{ pulp_python_interpreter }} -m venv'
with_dict: '{{ pulp_install_plugins }}'
Expand Down

0 comments on commit 8bb7db2

Please sign in to comment.