Bug 1104757 - [api] yumvars not set fail fedora metadata download
Summary: [api] yumvars not set fail fedora metadata download
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ales Kozumplik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-04 15:25 UTC by Parag Nemade
Modified: 2014-09-30 23:42 UTC (History)
5 users (show)

Fixed In Version: dnf-plugins-core-0.1.1-2.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-09 02:29:51 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Parag Nemade 2014-06-04 15:25:52 UTC
Description of problem:
I am trying to write a small code to query packages.
==========================
import dnf

db = dnf.Base()
db.read_all_repos()
sack=db.fill_sack()

q = db.sack.query()
a = q.available()
a = a.filter(name="hunspell")
for pkg in a:
    print(pkg.name)
====================================

When run above code as a root user, gave me traceback
$ sudo python dnf-srch.py 
Traceback (most recent call last):
  File "dnf-srch.py", line 5, in <module>
    sack=db.fill_sack()
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 207, in fill_sack
    self._add_repo_to_sack(r.id)
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 107, in _add_repo_to_sack
    repo.load()
  File "/usr/lib/python2.7/site-packages/dnf/repo.py", line 615, in load
    raise dnf.exceptions.RepoError(self._exc2msg(e))
dnf.exceptions.RepoError: Failed to synchronize cache for repo 'fedora': Cannot prepare internal mirrorlist: file repomd.xml was not found in metalink


Version-Release number of selected component (if applicable):
dnf-0.5.2-1.fc20.noarch
dnf-plugins-core-0.0.8-2.fc20.noarch
python3-dnf-0.5.2-1.fc20.noarch


How reproducible:
always

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Ales Kozumplik 2014-06-04 15:30:26 UTC
Will look at this.

Comment 2 Tim Lauridsen 2014-06-04 16:16:58 UTC
you need to add

db.conf.releasever = None

just before 
db.read_all_repos()

and it will work as root

Comment 3 Parag Nemade 2014-06-04 16:52:34 UTC
still not working after implementing above in code. The code sleeps forever when run as root.

I then after 2 min interrupted code and trace back is
^CTraceback (most recent call last):
  File "dnf-srch.py", line 6, in <module>
    sack=db.fill_sack()
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 207, in fill_sack
    self._add_repo_to_sack(r.id)
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 107, in _add_repo_to_sack
    repo.load()
  File "/usr/lib/python2.7/site-packages/dnf/repo.py", line 605, in load
    self._handle_load(handle)
  File "/usr/lib/python2.7/site-packages/dnf/repo.py", line 398, in _handle_load
    result = handle.perform()
  File "/usr/lib64/python2.7/site-packages/librepo/__init__.py", line 1322, in perform
    _librepo.Handle.perform(self, result)
KeyboardInterrupt


I run modified code thrice and it sleeps forever.

Comment 4 Tim Lauridsen 2014-06-05 07:32:32 UTC
You have to wait a little longer, if dnf does a full cache refresh, it take around 4-5 min.

You can check my dnf API samples here:
https://github.com/timlau/dnf-apiex

Comment 5 Parag Nemade 2014-06-05 07:59:55 UTC
Looks like now this modified code runs well today. Maybe today when I start the system, dnf got the full cache refresh when I did "dnf update"

Tim,
   Thanks. I will check your samples.

Comment 6 Ales Kozumplik 2014-06-05 13:51:17 UTC
> dnf.exceptions.RepoError: Failed to synchronize cache for repo 'fedora':
> Cannot prepare internal mirrorlist: file repomd.xml was not found in metalink

commit 1ecf1de improves the exception error message so the real problem is easier to spot.

we still have to improve or document the releasever setting.

Comment 7 Ales Kozumplik 2014-06-11 12:19:48 UTC
b3e8703 adds documentation that explains that substitutions need to be set prior to loading repositores.

Comment 8 Fedora Update System 2014-07-07 09:11:39 UTC
dnf-plugins-core-0.1.1-2.fc20, dnf-0.5.3-1.fc20, hawkey-0.4.17-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/dnf-0.5.3-1.fc20,hawkey-0.4.17-1.fc20,dnf-plugins-core-0.1.1-2.fc20

Comment 9 Fedora Update System 2014-07-08 01:03:58 UTC
Package dnf-plugins-core-0.1.1-2.fc20, dnf-0.5.3-1.fc20, hawkey-0.4.17-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dnf-plugins-core-0.1.1-2.fc20 dnf-0.5.3-1.fc20 hawkey-0.4.17-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-8167/dnf-0.5.3-1.fc20,hawkey-0.4.17-1.fc20,dnf-plugins-core-0.1.1-2.fc20
then log in and leave karma (feedback).

Comment 10 Fedora Update System 2014-07-09 02:29:51 UTC
dnf-plugins-core-0.1.1-2.fc20, dnf-0.5.3-1.fc20, hawkey-0.4.17-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 11 Parag Nemade 2014-07-14 09:33:41 UTC
I just tried to run the code given in initial comment again and found this is not fixed yet.
Traceback (most recent call last):
  File "simple-dnf-srch.py", line 5, in <module>
    sack=db.fill_sack()
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 203, in fill_sack
    self._add_repo_to_sack(r.id)
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 102, in _add_repo_to_sack
    repo.load()
  File "/usr/lib/python2.7/site-packages/dnf/repo.py", line 643, in load
    raise dnf.exceptions.RepoError(msg)
dnf.exceptions.RepoError: Failed to synchronize cache for repo 'fedora' from 'https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=x86_64': Cannot prepare internal mirrorlist: file repomd.xml was not found in metalink

Comment 12 Parag Nemade 2014-07-14 13:09:10 UTC
Thanks Ales. This http://akozumpl.github.io/dnf/api_conf.html#dnf.conf.Conf.substitutions helped me.


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