Bug 2109608

Summary: pulpcore rpm require of python38-jinja2 should be explicit about version
Product: Red Hat Satellite Reporter: Lukas Pramuk <lpramuk>
Component: PackagingAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Lukas Pramuk <lpramuk>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.11.1CC: osousa
Target Milestone: 6.11.3Keywords: Triaged, UpgradeBlocker
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pulpcore-3.16.13 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-09-28 16:28:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lukas Pramuk 2022-07-21 15:31:10 UTC
Description of problem:
pulpcore 3.16 rpm require of python38-jinja2 should be explicit about version. rpm spec requirement doesn't match pip requirement of jinja2 well enough
It can get only python38-jinja2 2.10.3 while it requires 3.0+

Missing version in requires can lead to installer failure, if you preinstall ansible-core or satellite-clone (at the time when satellite module is not present or yet disabled)

2022-07-20 18:16:57 [ERROR ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[migrate --noinput]/Exec[pulpcore-manager migrate --noinput]/returns: change from 'notrun' to ['0'] failed: 'pulpcore-manager migrate --noinput' returned 1 instead of one of [0]

Version-Release number of selected component (if applicable):
6.11.1

How reproducible:
deterministic

Steps to Reproduce:
1. Install ansible-core (jinja 2.10.3 installed)
2. Install pulpcore (or Satellite) (jinja 2.10.3 is not updated by 3.0.2)
3. Run pulpcore (or satellite-installer)

# pulpcore-manager collectstatic --noinput                                                                                                
Traceback (most recent call last):                                                                                                                           
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 583, in _build_master                                                              
    ws.require(__requires__)                                                                                                                                                             
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 900, in require                                                                                               
    needed = self.resolve(parse_requirements(requirements))                                                                                                                              
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 791, in resolve                                                                                               
    raise VersionConflict(dist, req).with_context(dependent_req)                                                                                                                        
pkg_resources.ContextualVersionConflict: (Jinja2 2.10.3 (/usr/lib/python3.8/site-packages), Requirement.parse('jinja2~=3.0'), {'pulpcore'})     


Actual results:
# rpm -qR python38-pulpcore | grep jinja
python38-jinja2

Expected results:
# rpm -qR python38-pulpcore | grep jinja
python38-jinja2 >= 3.0
rpm requires should reflect changes done in requirements.txt 


Additional info:
In 3.18 (Sat 6.12.0) this is already fixed

Comment 1 Lukas Pramuk 2022-07-21 15:34:47 UTC
You can't sat-clone *ON* the target machine.
The workaround is to do sat-clone somewhere else *TO* the target machine.

Comment 3 Lukas Pramuk 2022-09-02 19:42:50 UTC
This BZ prevents me to restore specific customer DB backup on 6.11 el8

TASK [satellite-clone : Run Satellite installer] *******************************
fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["satellite-installer", "--scenario", "satellite", "--foreman-proxy-dns", "false", "--foreman-proxy-dhcp", "false", "--foreman-proxy-tftp", "false", "--foreman-ipa-authentication", "false", "--reset-puppet-server-ssl-chain-filepath", "--disable-system-checks"]

...
2022-09-02 12:52:22 [NOTICE] [root] Loading installer configuration. This will take some time.
2022-09-02 12:52:27 [NOTICE] [root] Running installer with log based terminal output at level NOTICE.
2022-09-02 12:52:27 [NOTICE] [root] Use -l to set the terminal output log level to ERROR, WARN, NOTICE, INFO, or DEBUG. See --full-help for definitions.
2022-09-02 12:52:33 [WARN  ] [pre] Skipping system checks.
2022-09-02 12:52:33 [WARN  ] [pre] Skipping system checks.
2022-09-02 12:52:43 [NOTICE] [configure] Starting system configuration.
2022-09-02 12:53:11 [NOTICE] [configure] 250 configuration steps out of 2123 steps complete.
2022-09-02 12:54:33 [NOTICE] [configure] 500 configuration steps out of 2127 steps complete.
2022-09-02 12:54:46 [NOTICE] [configure] 750 configuration steps out of 2129 steps complete.
2022-09-02 12:54:54 [ERROR ] [configure] /Stage[main]/Pulpcore::Static/Pulpcore::Admin[collectstatic --noinput]/Exec[pulpcore-manager collectstatic --noinput]: Failed to call refresh: 'pulpcore-manager collectstatic --noinput' returned 1 instead of one of [0]
2022-09-02 12:54:54 [ERROR ] [configure] /Stage[main]/Pulpcore::Static/Pulpcore::Admin[collectstatic --noinput]/Exec[pulpcore-manager collectstatic --noinput]: 'pulpcore-manager collectstatic --noinput' returned 1 instead of one of [0]
2022-09-02 12:55:39 [NOTICE] [configure] 1000 configuration steps out of 2134 steps complete.
2022-09-02 12:56:25 [NOTICE] [configure] 1250 configuration steps out of 2158 steps complete.
2022-09-02 13:03:22 [NOTICE] [configure] 1500 configuration steps out of 2159 steps complete.
2022-09-02 13:04:29 [NOTICE] [configure] 1750 configuration steps out of 2159 steps complete.
2022-09-02 13:05:06 [NOTICE] [configure] 2000 configuration steps out of 2159 steps complete.
2022-09-02 13:07:12 [ERROR ] [configure] 'pulpcore-manager migrate --noinput' returned 1 instead of one of [0]
2022-09-02 13:07:12 [ERROR ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[migrate --noinput]/Exec[pulpcore-manager migrate --noinput]/returns: change from 'notrun' to ['0'] failed: 'pulpcore-manager migrate --noinput' returned 1 instead of one of [0]
2022-09-02 13:07:12 [ERROR ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[migrate --noinput]/Exec[pulpcore-manager migrate --noinput]: Failed to call refresh: 'pulpcore-manager migrate --noinput' returned 1 instead of one of [0]
2022-09-02 13:07:12 [ERROR ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[migrate --noinput]/Exec[pulpcore-manager migrate --noinput]: 'pulpcore-manager migrate --noinput' returned 1 instead of one of [0]
2022-09-02 13:07:18 [NOTICE] [configure] System configuration has finished.

  There were errors detected during install.
  Please address the errors and re-run the installer to ensure the system is properly configured.
  Failing to do so is likely to result in broken functionality.

  The full log is at /var/log/foreman-installer/satellite.log
Package versions are being locked.

/var/log/foreman-installer/satellite.log:
2022-09-02 12:54:54 [INFO  ] [configure] /Stage[main]/Pulpcore::Static/Pulpcore::Admin[collectstatic --noinput]/Exec[pulpcore-manager collectstatic --noinput]/returns: Traceback (most recent call last):
2022-09-02 12:54:54 [INFO  ] [configure] /Stage[main]/Pulpcore::Static/Pulpcore::Admin[collectstatic --noinput]/Exec[pulpcore-manager collectstatic --noinput]/returns:   File "/usr/bin/pulpcore-manager", line 6, in <module>
2022-09-02 12:54:54 [INFO  ] [configure] /Stage[main]/Pulpcore::Static/Pulpcore::Admin[collectstatic --noinput]/Exec[pulpcore-manager collectstatic --noinput]/returns:     from pkg_resources import load_entry_point
2022-09-02 12:54:54 [INFO  ] [configure] /Stage[main]/Pulpcore::Static/Pulpcore::Admin[collectstatic --noinput]/Exec[pulpcore-manager collectstatic --noinput]/returns:   File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3252, in <module>
2022-09-02 12:54:54 [INFO  ] [configure] /Stage[main]/Pulpcore::Static/Pulpcore::Admin[collectstatic --noinput]/Exec[pulpcore-manager collectstatic --noinput]/returns:     def _initialize_master_working_set():
2022-09-02 12:54:54 [INFO  ] [configure] /Stage[main]/Pulpcore::Static/Pulpcore::Admin[collectstatic --noinput]/Exec[pulpcore-manager collectstatic --noinput]/returns:   File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3235, in _call_aside
2022-09-02 12:54:54 [INFO  ] [configure] /Stage[main]/Pulpcore::Static/Pulpcore::Admin[collectstatic --noinput]/Exec[pulpcore-manager collectstatic --noinput]/returns:     f(*args, **kwargs)
2022-09-02 12:54:54 [INFO  ] [configure] /Stage[main]/Pulpcore::Static/Pulpcore::Admin[collectstatic --noinput]/Exec[pulpcore-manager collectstatic --noinput]/returns:   File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 3264, in _initialize_master_working_set
2022-09-02 12:54:54 [INFO  ] [configure] /Stage[main]/Pulpcore::Static/Pulpcore::Admin[collectstatic --noinput]/Exec[pulpcore-manager collectstatic --noinput]/returns:     working_set = WorkingSet._build_master()
2022-09-02 12:54:54 [INFO  ] [configure] /Stage[main]/Pulpcore::Static/Pulpcore::Admin[collectstatic --noinput]/Exec[pulpcore-manager collectstatic --noinput]/returns:   File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 585, in _build_master
2022-09-02 12:54:54 [INFO  ] [configure] /Stage[main]/Pulpcore::Static/Pulpcore::Admin[collectstatic --noinput]/Exec[pulpcore-manager collectstatic --noinput]/returns:     return cls._build_from_requirements(__requires__)
2022-09-02 12:54:54 [INFO  ] [configure] /Stage[main]/Pulpcore::Static/Pulpcore::Admin[collectstatic --noinput]/Exec[pulpcore-manager collectstatic --noinput]/returns:   File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 598, in _build_from_requirements
2022-09-02 12:54:54 [INFO  ] [configure] /Stage[main]/Pulpcore::Static/Pulpcore::Admin[collectstatic --noinput]/Exec[pulpcore-manager collectstatic --noinput]/returns:     dists = ws.resolve(reqs, Environment())
2022-09-02 12:54:54 [INFO  ] [configure] /Stage[main]/Pulpcore::Static/Pulpcore::Admin[collectstatic --noinput]/Exec[pulpcore-manager collectstatic --noinput]/returns:   File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 786, in resolve
2022-09-02 12:54:54 [INFO  ] [configure] /Stage[main]/Pulpcore::Static/Pulpcore::Admin[collectstatic --noinput]/Exec[pulpcore-manager collectstatic --noinput]/returns:     raise DistributionNotFound(req, requirers)
2022-09-02 12:54:54 [INFO  ] [configure] /Stage[main]/Pulpcore::Static/Pulpcore::Admin[collectstatic --noinput]/Exec[pulpcore-manager collectstatic --noinput]/returns: pkg_resources.DistributionNotFound: The 'jinja2~=3.0' distribution was not found and is required by pulpcore
2022-09-02 12:54:54 [ERROR ] [configure] /Stage[main]/Pulpcore::Static/Pulpcore::Admin[collectstatic --noinput]/Exec[pulpcore-manager collectstatic --noinput]: Failed to call refresh: 'pulpcore-manager collectstatic --noinput' returned 1 instead of one of [0]
2022-09-02 12:54:54 [ERROR ] [configure] /Stage[main]/Pulpcore::Static/Pulpcore::Admin[collectstatic --noinput]/Exec[pulpcore-manager collectstatic --noinput]: 'pulpcore-manager collectstatic --noinput' returned 1 instead of one of [0]


yum:

Installed Packages
python3-jinja2.noarch                                                   2.10.1-3.el8                                                                               @System                              
python38-jinja2.noarch                                                2.10.3-5.module+el8.5.0+10542+ba057329                                                    @APPSTREAM                           
Available Packages
...
python38-jinja2.noarch                                                   3.0.2-1.el8pc                                                                             satellite-6.11-for-rhel-8-x86_64-rpms

Comment 4 Lukas Pramuk 2022-09-02 19:52:08 UTC
The issue is caused by satellite-clone requiring ansible-core requiring  python38-jinja2 (of unspecified version -> 2.10.3)
Later on pulpcore-manager rpm installation should bump python38-jinja2 to version 3.0+ if its requirement were version specific

Workaround:
# yum --disableplugin foreman-protector distro-sync
# satellite-clone -y  (re-run)

Comment 5 Lukas Pramuk 2022-09-08 13:26:04 UTC
VERIFIED.

@Satellite 6.11.3 Snap1
python38-pulpcore-3.16.13-1.el8pc.noarch

by the manual reproducer described in comment#0:

# yum install ansible-core

# rpm -q python38-jinja2
python38-jinja2-2.10.3-5.module+el8.5.0+10542+ba057329.noarch

# yum module enable satellite

# yum install python38-pulpcore

# rpm -q python38-jinja2
python38-jinja2-3.0.2-1.el8pc.noarch

>>> python38-jinja2 gets upgraded to required version

# rpm -qR python38-pulpcore | grep jinja
python38-jinja2 >= 3.0

>>> pulpcore rpm is now specific about the version it requires

Comment 10 errata-xmlrpc 2022-09-28 16:28:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Satellite 6.11.3 Async Bug Fix Update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:6743