Skip to content

Commit

Permalink
Add usercache config option. BZ 1432319
Browse files Browse the repository at this point in the history
  • Loading branch information
dmnks committed Oct 20, 2017
1 parent 79d46eb commit 6e2c22f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2306,8 +2306,10 @@ def setupYumConfig(self, args=None):
self.base.updateinfo_filters['cves'] = self._splitArg(opts.cves)
self.base.updateinfo_filters['sevs'] = self._splitArg(opts.sevs)

if not self.base.conf.usercache and os.geteuid() != 0:
self.base.conf.cache = 1
# Treat users like root as much as possible:
if not self.base.setCacheDir():
elif not self.base.setCacheDir():
self.base.conf.cache = 1
if opts.cacheonly:
self.base.conf.cache = 1
Expand Down
13 changes: 13 additions & 0 deletions docs/yum.conf.5
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ of headers and packages after successful installation. Default is '1'
(keep files)
.br

.IP
\fBusercache\fR
Either `1' or `0'. Determines whether or not yum should store per-user cache in
$TMPDIR.
When set to `0', then whenever yum runs as a non\-root user,
\fB\-\-cacheonly\fR is implied and system cache is used directly, and no new
user cache is created in $TMPDIR.
This can be used to prevent $TMPDIR from filling up if many users on the system
often use yum and root tends to have up-to-date metadata that the users can
rely on (they can still enable this feature with \fB\-\-setopt\fR if they
wish).
Default is `1' (user cache enabled).

.IP
\fBreposdir\fR
A list of directories where yum should look for .repo files which define
Expand Down
1 change: 1 addition & 0 deletions yum/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@ class YumConf(StartupConf):
cashe_root_dir = Option('/var/cache/CAShe')

keepcache = BoolOption(True)
usercache = BoolOption(True)
logfile = Option('/var/log/yum.log')
reposdir = ListOption(['/etc/yum/repos.d', '/etc/yum.repos.d'])

Expand Down

0 comments on commit 6e2c22f

Please sign in to comment.