Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1062180
Summary: | [api] dnf.conf.Conf.cachedir doesn't have a default value | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Kamil Páral <kparal> |
Component: | dnf | Assignee: | Michal Luscon <mluscon> |
Status: | CLOSED DUPLICATE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 20 | CC: | jsilhan, jzeleny, mluscon, packaging-team-maint, pnemade, rholy, tla |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2015-01-29 14:25:49 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: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 1066869 |
Description
Kamil Páral
2014-02-06 12:10:58 UTC
I need to set a cachedir for both base and repo objects to get rid of the error. Like this: base.conf.cachedir = '/var/tmp/kparal-dnf' repo = dnf.repo.Repo('local repo','/var/tmp/kparal-dnf') If I set just the first one, the same error occurs. If I set only the second one, the error is different: IOError Traceback (most recent call last) <ipython-input-71-7f6a05b3c53f> in <module>() ----> 1 base.fill_sack(load_system_repo=False) /usr/lib/python2.7/site-packages/dnf/base.pyc in fill_sack(self, load_system_repo, load_available_repos) 210 if load_available_repos: 211 for r in self.repos.iter_enabled(): --> 212 self._add_repo_to_sack(r.id) 213 conf = self.conf 214 self._sack.configure(conf.installonlypkgs, conf.installonly_limit) /usr/lib/python2.7/site-packages/dnf/base.pyc in _add_repo_to_sack(self, name) 134 self.logger.debug("not found deltainfo for: %s" % repo.name) 135 repo.hawkey_repo = hrepo --> 136 self._sack.load_yum_repo(hrepo, build_cache=True, load_filelists=True) 137 138 def _setup_excludes(self): IOError: Can not read repomd file. this is an underspecified API feature. we will fix that (by providing the default probably) The current implementation need the following code to setup the cache when running as non-root. It will setup the cache dir to the same as the dnf cli does base = dnf.Base() base.conf.releasever = None # This will take the current release suffix = dnf.yum.parser.varReplace(dnf.const.CACHEDIR_SUFFIX, conf.yumvar) cli_cache = dnf.conf.CliCache(conf.cachedir, suffix) base.conf.cachedir = cli_cache.cachedir base._system_cachedir = cli_cache.system_cachedir sure it wil get more simple in some future realease of dnf :) Hi, in the current upstream version of dnf the base config contains default value of cachedir, so you can use it in the following way: base = dnf.Base() repos = base.repos repo = dnf.repo.Repo('local repo', base.conf.cachedir) repo.baseurl='file:///home/kparal/tmp/repo' repos.add(repo) base.fill_sack(load_system_repo=False) I have also extended cachedir_fit() with intention to use it for retrieving the dnf user and system cachedir: user_cachedir, system_cachedir = dnf.cli.cli.cachedir_fit(base.conf) Just a minor correction: (In reply to Michal Luscon from comment #4) > repo.baseurl='file:///home/kparal/tmp/repo' According to the documentation, "baseurl" should be a list of strings. *** This bug has been marked as a duplicate of bug 1184943 *** |