aboutsummaryrefslogtreecommitdiff
path: root/kolla/template/methods.py
diff options
context:
space:
mode:
authorMarcin Juszkiewicz <marcin.juszkiewicz@linaro.org>2020-01-02 09:56:10 +0100
committerMarcin Juszkiewicz <marcin.juszkiewicz@linaro.org>2020-01-02 09:58:58 +0100
commit2c2951b59b6e91c8f0ea6a82c1b3a9b16e1c02f7 (patch)
tree65792c94c4cb996657aa60590b8066dc9703607a /kolla/template/methods.py
parent90babe35d0e075ad15904bb2263e1dd019f10532 (diff)
downloadkolla-2c2951b59b6e91c8f0ea6a82c1b3a9b16e1c02f7.tar.gz
kolla-2c2951b59b6e91c8f0ea6a82c1b3a9b16e1c02f7.zip
centos: disable EPEL by default
Our images use 'scsi-target-utils' from EPEL and then can be built without it. So let's disable this repository right after installing package from it. Images can enable EPEL with 'enable_extra_repos' macro. Also added 'disable_extra_repos' macro as we have some images in a need. Change-Id: Id70474e7602b531b63fdc11ae690fd9ed33def74
Diffstat (limited to 'kolla/template/methods.py')
-rw-r--r--kolla/template/methods.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/kolla/template/methods.py b/kolla/template/methods.py
index c4c34125d..73e9d515a 100644
--- a/kolla/template/methods.py
+++ b/kolla/template/methods.py
@@ -72,7 +72,7 @@ def debian_package_install(packages, clean_package_cache=True):
@contextfunction
-def enable_repos(context, reponames):
+def handle_repos(context, reponames, mode):
"""NOTE(hrw): we need to handle CentOS, Debian and Ubuntu with one macro.
Repo names have to be simple names mapped to proper ones. So 'ceph' ==
@@ -80,6 +80,14 @@ def enable_repos(context, reponames):
something else for Debian.
Distro/arch are not required to have all entries - we ignore missing ones.
"""
+
+ if mode == 'enable':
+ rpm_switch = '--enable'
+ elif mode == 'disable':
+ rpm_switch = '--disable'
+ else:
+ raise KeyError
+
repofile = os.path.dirname(os.path.realpath(__file__)) + '/repos.yaml'
with open(repofile, 'r') as repos_file:
repo_data = {}
@@ -102,10 +110,11 @@ def enable_repos(context, reponames):
for repo in reponames:
try:
if base_package_type == 'rpm':
- commands += ' --enable %s' % repo_list[repo]
+ commands += ' %s %s' % (rpm_switch, repo_list[repo])
elif base_package_type == 'deb':
- commands += 'echo "%s" ' % repo_list[repo]
- commands += '>/etc/apt/sources.list.d/%s.list && ' % repo
+ if mode == 'enable':
+ commands += 'echo "%s" ' % repo_list[repo]
+ commands += '>/etc/apt/sources.list.d/%s.list && ' % repo
except KeyError:
# NOTE(hrw): we ignore missing repositories for a given
# distro/arch