Bug 1028140 - Trying to download packages that are not available shows a Python exception instead of a user friendly output
Trying to download packages that are not available shows a Python exception i...
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Zdeněk Pavlas
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2013-11-07 13:25 EST by Alberto Ruiz
Modified: 2014-02-02 17:29 EST (History)
5 users (show)

See Also:
Fixed In Version: dnf-0.4.6-1.fc20
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-11-08 03:50:44 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Alberto Ruiz 2013-11-07 13:25:06 EST
Description of problem:
While trying to download a package while offline the output shows a python exception.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Update all the repo data
2. Switch networking off
3. try to dnf update or dnf install something

Actual results:
Is this ok [y/N]: y
Downloading Packages:
Traceback (most recent call last):
  File "/bin/dnf", line 35, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 272, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 64, in main
    return _main(base, args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 187, in _main
    return_code, resultmsgs = base.do_transaction()
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 185, in do_transaction
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 1033, in download_packages
  File "/usr/lib64/python2.7/site-packages/librepo/__init__.py", line 1035, in download_packages
    return _librepo.download_packages(list, failfast)
librepo.LibrepoException: (8, "Curl error: Couldn't resolve host name for https://mirrors.fedoraproject.org/metalink?repo=fedora-20&arch=x86_64", 'An Curl handle error')

Expected results:
A user friendly output stating that there is no internet connectivity

Additional info:
Comment 1 Ales Kozumplik 2013-11-08 00:57:53 EST
Zdenek can you please take a look? All calls to librepo should ideally be wrapped within dnf.repo etc.
Comment 2 Zdeněk Pavlas 2013-11-08 03:50:44 EST
This is a bug in librepo. With failfast=False, librepo.download_packages() should not raise exception when host couldn't be resolved.

Could you include the dnf version, please?  We recently enabled failfast and handle LibrepoException, so it's being worked around already.
Comment 3 Alberto Ruiz 2013-11-08 07:29:11 EST
[997][aruiz@kerrigan ~]$ dnf --version
  Installed: dnf-0:0.4.5-1.fc20.noarch at 2013-10-21 13:25
  Built    : Fedora Project at 2013-10-20 12:10

  Installed: rpm-0:4.11.1-7.fc20.x86_64 at 2013-09-26 11:16
  Built    : Fedora Project at 2013-09-09 12:13
Comment 4 Zdeněk Pavlas 2013-11-08 08:29:36 EST
Yep, I thought so. This should be handled in 0.4.6

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