Bug 1028140

Summary: Trying to download packages that are not available shows a Python exception instead of a user friendly output
Product: [Fedora] Fedora Reporter: Alberto Ruiz <aruizrui>
Component: dnfAssignee: Zdeněk Pavlas <zpavlas>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: akozumpl, jzeleny, packaging-team-maint, pnemade, rholy
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dnf-0.4.6-1.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-08 08:50: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:

Description Alberto Ruiz 2013-11-07 18:25:06 UTC
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
    self.download_callback_total_cb)
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 1033, in download_packages
    librepo.download_packages(targets)
  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 05:57:53 UTC
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 08:50:44 UTC
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 12:29:11 UTC
[997][aruiz@kerrigan ~]$ dnf --version
0.4.5
  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 13:29:36 UTC
Yep, I thought so. This should be handled in 0.4.6