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

Commit

Permalink
Problem: pre-flight check does not check older pulp 3 installs properly
Browse files Browse the repository at this point in the history
Solution: Always generate a requirements.txt from `pip freeze`

fixes: #6642
pre-flight check does not analyze older pulp 3 installs properly
https://pulp.plan.io/issues/6642

re: https://pulp.plan.io/issues/6623
pulpcore and plugin pre-flight check seems to not be enforcing and then installer fails at collectstatic
  • Loading branch information
mikedep333 committed May 6, 2020
1 parent d42e73e commit 0ad5fc2
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGES/6642.bugfix
@@ -0,0 +1 @@
Fixed the pulpcore/plugin compatibility check not enforcing on upgrades from Pulp prior to 3.2.0, potentially resulting in a failure on collectstatic.
46 changes: 35 additions & 11 deletions roles/pulp/tasks/install.yml
Expand Up @@ -167,27 +167,51 @@
dest: "{{ pulp_install_dir }}/requirements.in"
when: pulp_source_dir is undefined

- name: Install pip-tools before running pip-comile to check version compatibility
- name: Install pip-tools before running pip-compile to check version compatibility
pip:
name: pip-tools
state: present
virtualenv: '{{ pulp_install_dir }}'
virtualenv_command: '{{ pulp_python_interpreter }} -m venv'

- name: Run pip-compile to check pulpcore/plugin compatibility
command: '{{ pulp_install_dir }}/bin/pip-compile'
args:
chdir: '{{ pulp_install_dir }}'
register: compatibility
- block:

# pip-compile creates requirements.txt, but we need to create it for these
# use cases:
# 1. upgrades from pulp installs older than the pip-compile check
# 2. Users manually modifying their venv
#
# We need requirements.txt because it affects what happens when users
# specify "pulp-file" (for example) without any version or an upgrade;
# pip-compile behaves differently depending on whether or not pulp-file is
# already installed (attempt to install newest version, vs leave it be.)
- name: list currently installed packages for the pip-compile check
shell: '{{ pulp_install_dir }}/bin/pip freeze > {{ pulp_install_dir }}/requirements.txt'
changed_when: false

- name: Backup currently installed packages for any potential troubleshooting purposes
copy:
src: '{{ pulp_install_dir }}/requirements.txt'
dest: '{{ pulp_install_dir }}/requirements.txt.orig'
remote_src: true
changed_when: false

- name: Run pip-compile to check pulpcore/plugin compatibility
command: '{{ pulp_install_dir }}/bin/pip-compile'
args:
chdir: '{{ pulp_install_dir }}'
register: compatibility
when: pulp_source_dir is undefined
# Some plugins have deps that need to be installed for setup.py to load. When an error
# occurs due to those missing deps, we can ignore it. The version comparison occurs before
# that error is raised. We only care about that contain this string.
failed_when: '"Could not find a version" in compatibility.stderr'
changed_when: false

environment:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
changed_when: false
when: pulp_source_dir is undefined
# Some plugins have deps that need to be installed for setup.py to load. When an error
# occurs due to those missing deps, we can ignore it. The version comparison occurs before
# that error is raised. We only care about that contain this string.
failed_when: '"Could not find a version" in compatibility.stderr'

become: true
become_user: '{{ pulp_user }}'
Expand Down

0 comments on commit 0ad5fc2

Please sign in to comment.