Bug 1184943

Summary: please enrich DNF API with a method for setting up base.conf.cachedir for non privileged users
Product: [Fedora] Fedora Reporter: Jakub Filak <jfilak>
Component: dnfAssignee: Michal Luscon <mluscon>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: akozumpl, jberan, jsilhan, kparal, mluscon, pnemade, rholy, tla
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
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 08:32:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 1066869, 1156485    

Description Jakub Filak 2015-01-22 14:28:22 UTC
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
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 14:25:49 UTC
*** Bug 1062180 has been marked as a duplicate of this bug. ***

Comment 2 Jakub Filak 2015-02-02 09:04:30 UTC
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>
  File "dnf_debuginfo.py", line 26, in download_debuginfo
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 222, in fill_sack
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 98, in _add_repo_to_sack
  File "/usr/lib/python2.7/site-packages/dnf/repo.py", line 772, in load
  File "/usr/lib/python2.7/site-packages/dnf/repo.py", line 623, in _replace_metadata
  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"

Comment 3 Jakub Filak 2015-02-02 09:16:49 UTC
(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.conf.cachedir = "/var/tmp/jfilak_dnf_donwloader"

The correct order:
  base.conf.cachedir = "/var/tmp/jfilak_dnf_donwloader"

Thank you, Radek Holy!

Comment 4 Michal Luscon 2015-02-13 10:38:36 UTC
*** Bug 1188186 has been marked as a duplicate of this bug. ***

Comment 5 Fedora Update System 2015-02-16 00:03:18 UTC
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.

Comment 6 Fedora Update System 2015-02-17 08:04:12 UTC
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:
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2015-02-20 08:32:30 UTC
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.