Bug 1858177

Summary: Typo error in reposync.py
Product: [Fedora] Fedora Reporter: Yuriy <smoker.tabac>
Component: cobblerAssignee: Orion Poplawski <orion>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 32CC: jimi, kwizart, ngompa13, orion, scott, vanmeeuwen+fedora
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: cobbler-3.2.0-2.fc32 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-03 01:29:39 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 Yuriy 2020-07-17 06:31:46 UTC
Description of problem:
cobbler reposync executes with an error due to typos in 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 --only=OEL-7-Latest --tries=1
task started: 2020-07-17_090517_reposync
task started (id=Reposync, time=Fri Jul 17 09:05:17 2020)
running python triggers from /var/lib/cobbler/triggers/task/reposync/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/reposync/pre/*
shell triggers finished successfully
hello, reposync
run, reposync, run!
creating: /var/www/cobbler/repo_mirror/OEL-7-Latest/config.repo
creating: /var/www/cobbler/repo_mirror/OEL-7-Latest/.origin/OEL-7-Latest.repo
running: /usr/bin/dnf reposync --newest-only --delete --config=/var/www/cobbler/repo_mirror/OEL-7-Latest/.origin/OEL-7-Latest.repo --repoid=OEL-7-Latest --download_path=/var/www/cobbler/repo_mirror -a x86_64
received on stdout: 
received on stderr: usage: dnf reposync [-c [config file]] [-q] [-v] [--version]
                    [--installroot [path]] [--nodocs] [--noplugins]
                    [--enableplugin [plugin]] [--disableplugin [plugin]]
                    [--releasever RELEASEVER] [--setopt SETOPTS]
--nobest] [-C]
                    [-R [minutes]] [-d [debug level]] [--debugsolver]
                    [--showduplicates] [-e ERRORLEVEL] [--obsoletes]
                    [--rpmverbosity [debug level name]] [-y] [--assumeno]
--repo
--disable] [-x [package]]
                    [--disableexcludes [repo]] [--repofrompath [repo,path]]
                    [--noautoremove] [--nogpgcheck] [--color COLOR]
                    [--refresh] [-4] [-6] [--destdir DESTDIR] [--downloadonly]
                    [--comment COMMENT] [--bugfix] [--enhancement]
                    [--newpackage] [--security] [--advisory ADVISORY]
                    [--bz BUGZILLA] [--cve CVES]
                    [--sec-severity {Critical,Important,Moderate,Low}]
                    [--forcearch ARCH] [-a [arch]] [--delete] [-m]
                    [--download-metadata] [-n] [-p DOWNLOAD_PATH]
                    [--norepopath] [--metadata-path METADATA_PATH] [--source]
                    [--remote-time] [-u]
dnf reposync: error: unrecognized arguments: --download_path=/var/www/cobbler/repo_mirror


Solution: 
--- reposync.py.orig	2020-07-06 20:58:12.496673490 +0300
+++ reposync.py	2020-07-17 09:21:23.236349282 +0300
@@ -378,7 +378,7 @@
         if has_rpm_list:
             self.logger.warning("warning: --rpm-list is not supported for RHN content")
         rest = repo.mirror[6:]      # everything after rhn://
-        cmd = "%s %s --repo=%s --download_path=%s" % (cmd, self.rflags, pipes.quote(rest), pipes.quote(self.settings.webdir + "/repo_mirror"))
+        cmd = "%s %s --repo=%s --download-path=%s" % (cmd, self.rflags, pipes.quote(rest), pipes.quote(self.settings.webdir + "/repo_mirror"))
         if repo.name != rest:
             args = {"name": repo.name, "rest": rest}
             utils.die(self.logger, "ERROR: repository %(name)s needs to be renamed %(rest)s as the name of the cobbler repository must match the name of the RHN channel" % args)

Comment 1 Nicolas Chauvet (kwizart) 2020-07-17 07:35:30 UTC
Unfortunately, seems the correct fix is not that easy.

reposync (as in yum for el7) correctly uses --download_path
 whereas 
dnf reposync (as in dnf in fedora or el8) uses --download-path

So a correct fix would set this option as appropriate depend ending on the case. (unless we don't care anymore about yum/dnf support).
I wonder if there are others differences in behaviour ?

Comment 2 Nicolas Chauvet (kwizart) 2020-07-17 07:35:53 UTC
Can you report this issue to cobbler upstream ?

Comment 3 Yuriy 2020-07-17 08:22:38 UTC
OK, I will send a report to cobbler upstream.

Comment 4 Nicolas Chauvet (kwizart) 2020-07-17 08:23:05 UTC
*** Bug 1858204 has been marked as a duplicate of this bug. ***

Comment 5 Yuriy 2020-07-22 14:10:25 UTC
The upstream of the cobbler accepted the patches I proposed:
 --download_path -> -p
 yum -> librepo
 other bug fixes

https://github.com/cobbler/cobbler/pull/2384
https://github.com/cobbler/cobbler/pull/2380
https://github.com/tpw56j/cobbler/commit/31fa87ddd6f848793870da7dee2b10d3756aa7d4

Comment 6 Fedora Update System 2020-10-25 21:58:38 UTC
FEDORA-2020-d834c6e46d has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-d834c6e46d

Comment 7 Fedora Update System 2020-10-26 01:37:36 UTC
FEDORA-2020-d834c6e46d has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-d834c6e46d`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-d834c6e46d

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2020-11-03 01:29:39 UTC
FEDORA-2020-d834c6e46d has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.