Skip to content

Commit ca511dd

Browse files
Marcin Juszkiewiczmmalchuk
authored andcommitted
Allow to provide own repos.yaml file
Several people use Kolla behind firewall/proxy. Internal mirrors are often in use then. We do not provide a way to replace repos.yaml file in an easy way which may lead to complicated solutions or template overrides. This patch adds a way to provide own copy of repos.yaml file. Change-Id: I0b07da22fea27e0ff4e90aaad19e50d84ff9a121 (cherry picked from commit 213190a)
1 parent 73a40f1 commit ca511dd

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

kolla/common/config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,9 @@
250250
cfg.BoolOpt('summary', default=True,
251251
help='Show summary at the end of build'),
252252
cfg.BoolOpt('infra-rename', default=False,
253-
help='Rename infrastructure images to infra')
253+
help='Rename infrastructure images to infra'),
254+
cfg.StrOpt('repos-yaml', default='',
255+
help='Path to alternative repos.yaml file'),
254256
]
255257

256258
_BASE_OPTS = [

kolla/image/build.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ def __init__(self, conf):
656656
self.base_tag = conf.base_tag
657657
self.install_type = conf.install_type
658658
self.tag = conf.tag
659+
self.repos_yaml = conf.repos_yaml
659660
self.base_arch = conf.base_arch
660661
self.debian_arch = self.base_arch
661662
if self.base_arch == 'aarch64':
@@ -890,6 +891,7 @@ def create_dockerfiles(self):
890891
'base_image': self.conf.base_image,
891892
'base_distro_tag': self.base_tag,
892893
'base_arch': self.base_arch,
894+
'repos_yaml': self.repos_yaml,
893895
'use_dumb_init': self.use_dumb_init,
894896
'base_package_type': self.base_package_type,
895897
'debian_arch': self.debian_arch,

kolla/template/methods.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ def handle_repos(context, reponames, mode):
9191
if not isinstance(reponames, list):
9292
raise TypeError("First argument should be a list of repositories")
9393

94-
repofile = os.path.dirname(os.path.realpath(__file__)) + '/repos.yaml'
94+
if context.get('repos_yaml'):
95+
repofile = context.get('repos_yaml')
96+
else:
97+
repofile = os.path.dirname(os.path.realpath(__file__)) + '/repos.yaml'
98+
9599
with open(repofile, 'r') as repos_file:
96100
repo_data = {}
97101
for name, params in yaml.safe_load(repos_file).items():
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
features:
3+
- |
4+
Added an `--repos-yaml` argument to allow user to provide own file with
5+
definitions of external package repositories. Useful for those building
6+
in offline environments with set of internal mirrors.

0 commit comments

Comments
 (0)