Bug 1858204 - reposync doesn't work in Fedora 32
Summary: reposync doesn't work in Fedora 32
Keywords:
Status: CLOSED DUPLICATE of bug 1858177
Alias: None
Product: Fedora
Classification: Fedora
Component: cobbler
Version: 32
Hardware: Unspecified
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Orion Poplawski
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-07-17 08:18 UTC by Yuriy
Modified: 2020-07-17 08:23 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2020-07-17 08:23:05 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Yuriy 2020-07-17 08:18:56 UTC
Description of problem:
Several problems in the code reposync.py

Version-Release number of selected component (if applicable):
cobbler-3.1.2-1.fc32.noarch

How reproducible:
cobbler reposync

Actual results:
cobbler reposync fail

Additional info:

Problem 1:

received on stderr: 
Exception occured: <class 'UnboundLocalError'>
Exception value: local variable 'cert' referenced before assignment
Exception Info:
  File "/usr/lib/python3.8/site-packages/cobbler/actions/reposync.py", line 163, in run
    self.sync(repo)

  File "/usr/lib/python3.8/site-packages/cobbler/actions/reposync.py", line 206, in sync
    self.yum_sync(repo)

  File "/usr/lib/python3.8/site-packages/cobbler/actions/reposync.py", line 524, in yum_sync
    (cert, verify) = self.gen_urlgrab_ssl_opts(repo.yumopts)

  File "/usr/lib/python3.8/site-packages/cobbler/actions/reposync.py", line 434, in gen_urlgrab_ssl_opts
    return (cert, verify)

Workaround 1:

Assign a value to variables prior to use.
--- reposync.py.orig	2020-07-06 20:58:12.496673490 +0300
+++ reposync.py.my	2020-07-17 09:52:50.525167207 +0300
@@ -421,6 +421,8 @@
         :rtype: (str, bool)
         """
         # use SSL options if specified in yum opts
+        cert = None
+        verify = False
         if 'sslclientkey' and 'sslclientcert' in yumopts:
             cert = (yumopts['sslclientcert'], yumopts['sslclientkey'])
         # Note that the default of requests is to verify the peer and host but the default here is NOT to verify them

Problem 2 (after workaround 1):

The download_file definition does not contain the "verify" parameter.
download_manager.py:    def download_file(self, url, dst, proxies=None, cert=None)

received on stderr: 
Exception occured: <class 'TypeError'>
Exception value: can only concatenate str (not "tuple") to str
Exception Info:
  File "/usr/lib/python3.8/site-packages/cobbler/actions/reposync.py", line 163, in run
    self.sync(repo)

  File "/usr/lib/python3.8/site-packages/cobbler/actions/reposync.py", line 206, in sync
    self.yum_sync(repo)

  File "/usr/lib/python3.8/site-packages/cobbler/actions/reposync.py", line 530, in yum_sync
    utils.die(self.logger, "failed to fetch " + src + " " + e.args)

Workaround 2:

--- reposync.py.orig	2020-07-06 20:58:12.496673490 +0300
+++ reposync.py	2020-07-17 10:22:14.495238163 +0300
@@ -523,7 +525,7 @@
         dst = temp_path + "/repomd.xml"
         (cert, verify) = self.gen_urlgrab_ssl_opts(repo.yumopts)
         try:
-            self.dlmgr.download_file(src, dst, proxies, cert, verify)
+            self.dlmgr.download_file(src, dst, proxies, cert)
         except Exception as e:
             utils.die(self.logger, "failed to fetch " + src + " " + e.args)


Problem 3 (after workaround 3):

YUM API has been removed in Fedora 32.

# dnf install yum-utils
Package dnf-utils-4.0.16-1.fc32.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!

# cobbler reposync
< .. >
received on stderr: 
Exception occured: <class 'NameError'>
Exception value: name 'yum' is not defined
Exception Info:
  File "/usr/lib/python3.8/site-packages/cobbler/actions/reposync.py", line 163, in run
    self.sync(repo)

  File "/usr/lib/python3.8/site-packages/cobbler/actions/reposync.py", line 206, in sync
    self.yum_sync(repo)

  File "/usr/lib/python3.8/site-packages/cobbler/actions/reposync.py", line 535, in yum_sync
    rmd = yum.repoMDObject.RepoMD('', "%s/repomd.xml" % (temp_path))

Comment 1 Nicolas Chauvet (kwizart) 2020-07-17 08:23:05 UTC
duplicate of 1858177 cobbler needs to be ported to dnf reposync over (yum) reposync

Please forward patches upstrem.

*** This bug has been marked as a duplicate of bug 1858177 ***


Note You need to log in before you can comment on or make changes to this bug.