Bug 1104757 - [api] yumvars not set fail fedora metadata download
[api] yumvars not set fail fedora metadata download
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Ales Kozumplik
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2014-06-04 11:25 EDT by Parag Nemade
Modified: 2014-09-30 19:42 EDT (History)
5 users (show)

See Also:
Fixed In Version: dnf-plugins-core-0.1.1-2.fc20
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-07-08 22:29:51 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Parag Nemade 2014-06-04 11:25:52 EDT
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 11:30:26 EDT
Will look at this.
Comment 2 Tim Lauridsen 2014-06-04 12:16:58 EDT
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 12:52:34 EDT
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 03:32:32 EDT
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 03:59:55 EDT
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 09:51:17 EDT
> 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 08:19:48 EDT
b3e8703 adds documentation that explains that substitutions need to be set prior to loading repositores.
Comment 8 Fedora Update System 2014-07-07 05:11:39 EDT
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-07 21:03:58 EDT
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-08 22:29:51 EDT
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 05:33:41 EDT
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 09:09:10 EDT
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.