Bug 1184943 - please enrich DNF API with a method for setting up base.conf.cachedir for non privileged users
please enrich DNF API with a method for setting up base.conf.cachedir for non...
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Michal Luscon
Fedora Extras Quality Assurance
:
: 1062180 1188186 (view as bug list)
Depends On:
Blocks: 1066869 1156485
  Show dependency treegraph
 
Reported: 2015-01-22 09:28 EST by Jakub Filak
Modified: 2016-11-30 19:48 EST (History)
8 users (show)

See Also:
Fixed In Version: hawkey-0.5.3-2.fc21
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-02-20 03:32:30 EST
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 Jakub Filak 2015-01-22 09:28:22 EST
Description of problem:
I am working on a script for downloading of custom packages identified by file names. When I call dnf.Base.fill_sack() I get the following exception:

  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 216, in fill_sack
    self._sack.load_system_repo(build_cache=True)
IOError: Failed writing the cache.

Radek Holy advised me to set base.conf.cachedir to a pathe where I have write rights.

I think DNF should configure base.conf.cachedir on its own, because I as an application developer don't want to care about such things. Aas a bonus, all DNF API consumers would use the same cache.
Comment 1 Michal Luscon 2015-01-29 09:25:49 EST
*** Bug 1062180 has been marked as a duplicate of this bug. ***
Comment 2 Jakub Filak 2015-02-02 04:04:30 EST
Follow-up: I set base.conf.cachedir to '/var/tmp/jfilak_dnf_donwloader/' and I got the following exception:

Traceback (most recent call last):
  File "dnf_debuginfo.py", line 38, in <module>
    download_debuginfo()
  File "dnf_debuginfo.py", line 26, in download_debuginfo
    base.fill_sack()
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 222, in fill_sack
    self._add_repo_to_sack(r.id)
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 98, in _add_repo_to_sack
    repo.load()
  File "/usr/lib/python2.7/site-packages/dnf/repo.py", line 772, in load
    self._replace_metadata(handle)
  File "/usr/lib/python2.7/site-packages/dnf/repo.py", line 623, in _replace_metadata
    dnf.util.ensure_dir(self.cachedir)
  File "/usr/lib/python2.7/site-packages/dnf/util.py", line 63, in ensure_dir
    os.makedirs(dname, mode=0o755)
  File "/usr/lib64/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/var/cache/dnf/updates-debuginfo'


Is there something wrong on these lines?
  base.conf.cachedir = "/var/tmp/jfilak_dnf_donwloader"
  base.fill_sack()
Comment 3 Jakub Filak 2015-02-02 04:16:49 EST
(In reply to Jakub Filak from comment #2)
> 
> Is there something wrong on these lines?
>   base.conf.cachedir = "/var/tmp/jfilak_dnf_donwloader"
>   base.fill_sack()

Yes, the function calls are in a bad order.

All my calls:
  base.read_all_repos()
  base.conf.cachedir = "/var/tmp/jfilak_dnf_donwloader"
  base.fill_sack()

The correct order:
  base.conf.cachedir = "/var/tmp/jfilak_dnf_donwloader"
  base.read_all_repos()
  base.fill_sack()


Thank you, Radek Holy!
Comment 4 Michal Luscon 2015-02-13 05:38:36 EST
*** Bug 1188186 has been marked as a duplicate of this bug. ***
Comment 5 Fedora Update System 2015-02-15 19:03:18 EST
dnf-plugins-core-0.1.5-1.fc21,hawkey-0.5.3-2.fc21,dnf-0.6.4-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/dnf-plugins-core-0.1.5-1.fc21,hawkey-0.5.3-2.fc21,dnf-0.6.4-1.fc21
Comment 6 Fedora Update System 2015-02-17 03:04:12 EST
Package hawkey-0.5.3-2.fc21, dnf-plugins-core-0.1.5-1.fc21, dnf-0.6.4-1.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing hawkey-0.5.3-2.fc21 dnf-plugins-core-0.1.5-1.fc21 dnf-0.6.4-1.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-2139/dnf-plugins-core-0.1.5-1.fc21,hawkey-0.5.3-2.fc21,dnf-0.6.4-1.fc21
then log in and leave karma (feedback).
Comment 7 Fedora Update System 2015-02-20 03:32:30 EST
hawkey-0.5.3-2.fc21, dnf-plugins-core-0.1.5-1.fc21, dnf-0.6.4-1.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

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