Bug 1298246

Summary: dnf copr enable gives a long traceback for an invalid repo name
Product: [Fedora] Fedora Reporter: Zbigniew JÄ™drzejewski-Szmek <zbyszek>
Component: dnf-plugins-coreAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: ignatenko, jmracek, jsilhan, mluscon, packaging-team-maint, pnemade, RadekHolyPublic, vmukhame
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-01-19 14:00:44 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 Zbigniew Jędrzejewski-Szmek 2016-01-13 15:18:22 UTC
Description of problem:
$ dnf copr enable xxxx/yyyy

You are about to enable a Copr repository. Please note that this
repository is not part of the main Fedora distribution, and quality
may vary.

The Fedora Project does not exercise any power over the contents of
this repository beyond the rules outlined in the Copr FAQ at
<https://fedorahosted.org/copr/wiki/UserDocs#WhatIcanbuildinCopr>, and
packages are not held to any quality or security level.

Please do not file bug reports about these packages in Fedora
Bugzilla. In case of problems, contact the owner of this repository.

Do you want to continue? [y/N]: y
Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/dnfpluginscore/lib.py", line 71, in urlopen
    librepo.download_url(url, fo.fileno(), handle)
  File "/usr/lib64/python3.4/site-packages/librepo/__init__.py", line 1517, in download_url
    return _librepo.download_url(handle, url, fd)
librepo.LibrepoException: (10, 'Status code: 404 for https://copr.fedoraproject.org/coprs/xxxx/yyyy/repo/fedora-23/', 'Error HTTP/FTP status code')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/dnf-plugins/copr.py", line 264, in _download_repo
    f = dnfpluginscore.lib.urlopen(self, None, self.copr_url + api_path, 'w+')
  File "/usr/lib/python3.4/site-packages/dnfpluginscore/lib.py", line 73, in urlopen
    raise IOError(e.args[1])
OSError: Status code: 404 for https://copr.fedoraproject.org/coprs/xxxx/yyyy/repo/fedora-23/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/bin/dnf", line 57, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 174, in user_main
    errcode = main(args)
  File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 60, in main
    return _main(base, args)
  File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 112, in _main
    cli.run()
  File "/usr/lib/python3.4/site-packages/dnf/cli/cli.py", line 1095, in run
    return self.command.run(self.base.extcmds)
  File "/usr/lib/python3.4/site-packages/dnf-plugins/copr.py", line 153, in run
    self._download_repo(project_name, repo_filename, chroot)
  File "/usr/lib/python3.4/site-packages/dnf-plugins/copr.py", line 272, in _download_repo
    res = urllib.request.urlopen(self.copr_url + "/coprs/" + project_name, 'w+')
  File "/usr/lib64/python3.4/urllib/request.py", line 161, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib64/python3.4/urllib/request.py", line 461, in open
    req = meth(req)
  File "/usr/lib64/python3.4/urllib/request.py", line 1112, in do_request_
    raise TypeError(msg)
TypeError: POST data should be bytes or an iterable of bytes. It cannot be of type str.

Version-Release number of selected component (if applicable):
python3-dnf-plugins-core-0.1.15-1.fc23.noarch

Expected results:
A clean error, something like xxxx/yyyy is not a valid copr repo name:
Status code: 404 for https://copr.fedoraproject.org/coprs/xxxx/yyyy/repo/fedora-23/.

Comment 1 Jaroslav Mracek 2016-01-19 14:00:44 UTC

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

Comment 2 Igor Gnatenko 2016-07-21 13:28:33 UTC

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