From ada424078bff297dcd4c16980a0444a31deabb87 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Tue, 16 Jun 2015 06:57:32 -0700 Subject: [PATCH] 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 --- lib/ansible/modules/packaging/os/yum.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/ansible/modules/packaging/os/yum.py b/lib/ansible/modules/packaging/os/yum.py index 9e88c5404fd..fa69434284e 100644 --- a/lib/ansible/modules/packaging/os/yum.py +++ b/lib/ansible/modules/packaging/os/yum.py @@ -171,6 +171,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):