ansible-collections / cisco.iosxr

Ansible Network Collection for Cisco IOSXR
GNU General Public License v3.0
69 stars 48 forks source link

The collection bindep is hardcoding python version #387

Closed lucas-benedito closed 1 year ago

lucas-benedito commented 1 year ago
SUMMARY

While installing the collection and using the bindep offered by the same, my build ended up installing python38 due to the hardcoded bindep with python38-lxml

ISSUE TYPE
COMPONENT NAME

task

ANSIBLE VERSION
ansible-core 2.14
ansible-builder 1.2.0
COLLECTION VERSION
version: "5.0.1"
CONFIGURATION
Default config
OS / ENVIRONMENT
RHEL 8.7
STEPS TO REPRODUCE

Building Execution Environment using ansible-builder with the files below

execution-environment.yml 
version: 1

build_arg_defaults:
  EE_BASE_IMAGE: registry.redhat.io/ansible-automation-platform-23/ee-minimal-rhel8:latest

ansible_config: 'ansible.cfg' 

dependencies:
  galaxy: requirements.yml
requirements.yml
---
collections:
  - name: cisco.iosxr
    version: "5.0.1"
EXPECTED RESULTS
Dependencies installed from Python 3.9
ACTUAL RESULTS
- 'python38-lxml [platform:centos-8 platform:rhel-8]  # from collection cisco.iosxr'
NilashishC commented 1 year ago

@lucas-benedito Do you mean that installing python38-lxml downgrades the Python version in ee-minimal-rhel8 to Python 3.8?

lucas-benedito commented 1 year ago

@NilashishC it forces the installation of both versions as the package name enforces python 3.8. This causes a mismatch where the execution environment discovered python is 3.9 but the libraries are installed in 3.8

NilashishC commented 1 year ago

@lucas-benedito Ah, I see. I get it now. Thanks for the info.

NilashishC commented 1 year ago

This should be resolved if we use python3-lxml instead.

(nchakrab) $ podman run -it registry-proxy.engineering.redhat.com/rh-osbs/ansible-automation-platform-23-ee-minimal-rhel8 /bin/bash

bash-4.4# microdnf install python3-lxml

(microdnf:18): librhsm-WARNING **: 07:44:02.683: Found 0 entitlement certificates

(microdnf:18): librhsm-WARNING **: 07:44:02.685: Found 0 entitlement certificates
Downloading metadata...
Downloading metadata...
Downloading metadata...
Package                                                                                                       Repository                                Size
Installing:                                                                                                                                                 
 gdbm-1:1.18-2.el8.x86_64                                                                                     ubi-8-baseos-rpms                     132.8 kB
 platform-python-3.6.8-51.el8_8.1.x86_64                                                                      ubi-8-baseos-rpms                      88.6 kB
 platform-python-pip-9.0.3-22.el8.noarch                                                                      ubi-8-baseos-rpms                       1.7 MB
 platform-python-setuptools-39.2.0-7.el8.noarch                                                               ubi-8-baseos-rpms                     647.4 kB
 python3-html5lib-1:0.999999999-6.el8.noarch                                                                  ubi-8-appstream-rpms                  218.9 kB
 python3-libs-3.6.8-51.el8_8.1.x86_64                                                                         ubi-8-baseos-rpms                       8.2 MB
 python3-lxml-4.2.3-4.el8.x86_64                                                                              ubi-8-appstream-rpms                    1.6 MB
 python3-pip-wheel-9.0.3-22.el8.noarch                                                                        ubi-8-baseos-rpms                     916.3 kB
 python3-setuptools-wheel-39.2.0-7.el8.noarch                                                                 ubi-8-baseos-rpms                     296.0 kB
 python3-six-1.11.0-8.el8.noarch                                                                              ubi-8-baseos-rpms                      39.4 kB
 python3-webencodings-0.5.1-6.el8.noarch                                                                      ubi-8-appstream-rpms                   27.6 kB
Upgrading:                                                                                                                                                  
 gdbm-libs-1:1.18-2.el8.x86_64                                                                                ubi-8-baseos-rpms                      61.8 kB
   replacing gdbm-libs-1:1.18-1.el8.x86_64                                                                                                                  
Transaction Summary:
 Installing:       11 packages
 Reinstalling:      0 packages
 Upgrading:         1 packages
 Obsoleting:        0 packages
 Removing:          0 packages
 Downgrading:       0 packages
Downloading packages...
Running transaction test...
Updating: gdbm-libs;1:1.18-2.el8;x86_64;ubi-8-baseos-rpms
Installing: python3-setuptools-wheel;39.2.0-7.el8;noarch;ubi-8-baseos-rpms
Installing: python3-pip-wheel;9.0.3-22.el8;noarch;ubi-8-baseos-rpms
Installing: gdbm;1:1.18-2.el8;x86_64;ubi-8-baseos-rpms
Installing: platform-python-pip;9.0.3-22.el8;noarch;ubi-8-baseos-rpms
Installing: platform-python-setuptools;39.2.0-7.el8;noarch;ubi-8-baseos-rpms
Installing: platform-python;3.6.8-51.el8_8.1;x86_64;ubi-8-baseos-rpms
Installing: python3-libs;3.6.8-51.el8_8.1;x86_64;ubi-8-baseos-rpms
Installing: python3-six;1.11.0-8.el8;noarch;ubi-8-baseos-rpms
Installing: python3-webencodings;0.5.1-6.el8;noarch;ubi-8-appstream-rpms
Installing: python3-html5lib;1:0.999999999-6.el8;noarch;ubi-8-appstream-rpms
Installing: python3-lxml;4.2.3-4.el8;x86_64;ubi-8-appstream-rpms
Cleanup: gdbm-libs;1:1.18-1.el8;x86_64;installed
Complete.

bash-4.4# python3.8
bash: python3.8: command not found
bash-4.4# 
lucas-benedito commented 1 year ago

Yes, the problem is that we use a discovery from the collection and if the bindep that comes with it shows a mixed of python 39 and 38 then it leads to the issue informed.