Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1982135

Summary: tito build fails with ImportError: No module named request
Product: [Fedora] Fedora EPEL Reporter: Pavol Babinčák <pbabinca>
Component: titoAssignee: Jakub Kadlčík <jkadlcik>
Status: MODIFIED --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: epel7CC: dgoodwin, jkadlcik
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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 Pavol Babinčák 2021-07-14 09:56:05 UTC
Description of problem:
tito build cannot be used on RHEL 7 machine which has python2 interpreter

Version-Release number of selected component (if applicable):
tito-0.6.18-1.el7

How reproducible:
Always

Steps to Reproduce:
0. $ podman run --rm -ti rhel7 bash   
# yum-config-manager --enable rhel-7-server-optional-rpms > /dev/null
# yum-config-manager --enable rhel-7-server-extras-rpms > /dev/null
# yum --quiet -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
1. Install tito: yum --quiet -y install tito
2. Take any configured project, e.g. tito repo itself: git clone https://github.com/rpm-software-management/tito && cd ./tito
3. Try to create a tarball: tito build --offline --tgz

Actual results:
Creating output directory: /tmp/tito
Traceback (most recent call last):
  File "/usr/bin/tito", line 9, in <module>
    load_entry_point('tito==0.6.18', 'console_scripts', 'tito')()
  File "/usr/lib/python2.7/site-packages/tito/cli.py", line 910, in main
    CLI().main(sys.argv[1:])
  File "/usr/lib/python2.7/site-packages/tito/cli.py", line 209, in main
    return module.main(argv)
  File "/usr/lib/python2.7/site-packages/tito/cli.py", line 391, in main
    builder_class=self.options.builder, **kwargs)
  File "/usr/lib/python2.7/site-packages/tito/common.py", line 161, in create_builder
    "builder"))
  File "/usr/lib/python2.7/site-packages/tito/common.py", line 976, in get_class_by_name
    mod = __import__(module, globals(), locals(), [class_name])
  File "/usr/lib/python2.7/site-packages/tito/builder/__init__.py", line 6, in <module>
    from tito.builder.main import \
  File "/usr/lib/python2.7/site-packages/tito/builder/main.py", line 24, in <module>
    import urllib.request
ImportError: No module named request


Expected results:
No error, e.g.:

Building package [tito-0.6.18-1]
Wrote: /tmp/tito/tito-0.6.18.tar.gz


Additional info:

I believe this bug was introduced with https://github.com/rpm-software-management/tito/commit/5de167e0ff134fa682ccac55f511ce04877c1707 which uses python3-only import.

Comment 1 Jakub Kadlčík 2021-07-14 22:17:43 UTC
Thank you for the report Pavol and for taking the time to point out the source of the problem.

I had a little difficulty with the reproducer, so I modified it slightly.

$ docker run -it centos:7 bash
# yum install epel-release
# yum install tito 
# git clone https://github.com/rpm-software-management/tito && cd ./tito
# tito build --offline --tgz

The proposed fix is here: https://github.com/rpm-software-management/tito/pull/409

Comment 2 Pavol Babinčák 2021-07-15 08:24:16 UTC
(In reply to Jakub Kadlčík from comment #1)
> Thank you for the report Pavol and for taking the time to point out the
> source of the problem.

No worries! I guess I should've written that I have run those commands on already subscribed RHEL 8 machine.

I guess you might have run into issue with that - subscription manager is disabled in containers in that case but one could use yum-config-manager to enable repositories.