summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToshio Kuratomi <toshio@fedoraproject.org>2015-06-16 06:57:32 -0700
committerToshio Kuratomi <toshio@fedoraproject.org>2015-06-16 13:12:57 -0700
commitfbcd0d949c314ad882452520025b9dc550524fa2 (patch)
treee86f51aa64bad71bc778685a7afb046cffcd287c
parent2e240e1c8eb6cfaf66ec0c10e8d132860a9f0901 (diff)
downloadansible-modules-core-fbcd0d949c314ad882452520025b9dc550524fa2.tar.gz
Restore setting cachedir when non-root but don't take a useless cachedir parameter to the function
* Revert "Remove unused code" This reverts commit bcfba0c05098696b6e770335870a9c22792fec38. * Re-add the changes to remove cachedir as a parameter
-rw-r--r--packaging/os/yum.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/packaging/os/yum.py b/packaging/os/yum.py
index 6652b115..15a4df40 100644
--- a/packaging/os/yum.py
+++ b/packaging/os/yum.py
@@ -163,6 +163,14 @@ def yum_base(conf_file=None):
my.preconf.errorlevel=0
if conf_file and os.path.exists(conf_file):
my.preconf.fn = conf_file
+ if os.geteuid() != 0:
+ if hasattr(my, 'setCacheDir'):
+ my.setCacheDir()
+ else:
+ cachedir = yum.misc.getCacheDir()
+ my.repos.setCacheDir(cachedir)
+ my.conf.cache = 0
+
return my
def install_yum_utils(module):