Hide Forgot
Description of problem: TB when you try to enable non-existent copr project. Version-Release number of selected component (if applicable): How reproducible: deterministic Steps to Reproduce: 1. dnf copr enable @copr/xxjkhalkjhlkj fedora-23-x86_64 Actual results: ... 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 http://copr-fe-dev.cloud.fedoraproject.org/coprs/@copr/kjhgkjhgkjh/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 http://copr-fe-dev.cloud.fedoraproject.org/coprs/@copr/kjhgkjhgkjh/repo/fedora-23/ During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/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.
Jakub, can you fix it please?
Already reported in bug 1302235
There is one more bug 1302232 to look related to this.
The line causing this problem is res = urllib.request.urlopen(self.copr_url + "/coprs/" + project_name, 'w+') status_code = res.getcode() Here: https://github.com/rpm-software-management/dnf-plugins-core/blob/8261eb9a060b0cbf57d82b4f94291242a4b233ec/plugins/copr.py#L272 Syntax for urlopen is urllib.request.urlopen(url, data=None, [timeout, ]*, cafile=None, capath=None, cadefault=False, context=None) so the 'w+' in our code is passed as `data` argument. Issue is that `data` can't be string, therefore it fails and solution would be encoding it. I can do that, but first, I want to ask Mirek. What is the purpose of 'w+' in this code? Do we really want to send 'w+' in data, or is it just a typo? I suspect that it could happen by copying some usage of dnfpluginscore.lib.urlopen(...., 'w+') Thanks
This issue have origins in 1267808. In order to solve it, Honza Horak proposed a patch containing: - f = dnfpluginscore.lib.urlopen(self, None, api_url) + f = dnfpluginscore.lib.urlopen(self, None, api_url, "w+") which was modified and applied in aff262d. Unfortunately in this commit were changed even this lines: - res = urllib.request.urlopen(self.copr_url + "/coprs/" + project_name) + res = urllib.request.urlopen(self.copr_url + "/coprs/" + project_name, 'w+') and - res = urllib.urlopen(self.copr_url + "/coprs/" + project_name) + res = urllib.urlopen(self.copr_url + "/coprs/" + project_name, 'w+') I am sending following PR to fix it: https://github.com/rpm-software-management/dnf-plugins-core/pull/149
dnf-plugins-core-0.1.19-1.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-d8b69dc579
dnf-plugins-core-0.1.19-1.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-c0777f4cf3
dnf-plugins-core-0.1.19-1.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2016-adcfaafc5c
dnf-plugins-core-0.1.19-1.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-c0777f4cf3
dnf-plugins-core-0.1.19-1.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-adcfaafc5c
dnf-plugins-core-0.1.19-1.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-d8b69dc579
dnf-plugins-core-0.1.19-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.
dnf-plugins-core-0.1.19-1.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.
dnf-plugins-core-0.1.19-1.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.
*** Bug 1288960 has been marked as a duplicate of this bug. ***
*** Bug 1276932 has been marked as a duplicate of this bug. ***
*** Bug 1298246 has been marked as a duplicate of this bug. ***