Skip to content

Commit e90786a

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 6298c0e commit e90786a

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
@@ -249,7 +249,9 @@
249249
cfg.BoolOpt('summary', default=True,
250250
help='Show summary at the end of build'),
251251
cfg.BoolOpt('infra-rename', default=False,
252-
help='Rename infrastructure images to infra')
252+
help='Rename infrastructure images to infra'),
253+
cfg.StrOpt('repos-yaml', default='',
254+
help='Path to alternative repos.yaml file'),
253255
]
254256

255257
_BASE_OPTS = [

kolla/image/build.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,7 @@ def __init__(self, conf):
654654
self.base_tag = conf.base_tag
655655
self.install_type = conf.install_type
656656
self.tag = conf.tag
657+
self.repos_yaml = conf.repos_yaml
657658
self.base_arch = conf.base_arch
658659
self.debian_arch = self.base_arch
659660
if self.base_arch == 'aarch64':
@@ -880,6 +881,7 @@ def create_dockerfiles(self):
880881
'base_image': self.conf.base_image,
881882
'base_distro_tag': self.base_tag,
882883
'base_arch': self.base_arch,
884+
'repos_yaml': self.repos_yaml,
883885
'use_dumb_init': self.use_dumb_init,
884886
'base_package_type': self.base_package_type,
885887
'debian_arch': self.debian_arch,

kolla/template/methods.py

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

98-
repofile = os.path.dirname(os.path.realpath(__file__)) + '/repos.yaml'
98+
if context.get('repos_yaml'):
99+
repofile = context.get('repos_yaml')
100+
else:
101+
repofile = os.path.dirname(os.path.realpath(__file__)) + '/repos.yaml'
102+
99103
with open(repofile, 'r') as repos_file:
100104
repo_data = {}
101105
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)