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
This commit is contained in:
parent
d424a63d60
commit
213190ae03
|
@ -251,6 +251,8 @@ _CLI_OPTS = [
|
|||
help='Show summary at the end of build'),
|
||||
cfg.StrOpt('image-name-prefix', default='',
|
||||
help='Prefix prepended to image names'),
|
||||
cfg.StrOpt('repos-yaml', default='',
|
||||
help='Path to alternative repos.yaml file'),
|
||||
]
|
||||
|
||||
_BASE_OPTS = [
|
||||
|
|
|
@ -611,6 +611,7 @@ class KollaWorker(object):
|
|||
self.use_dumb_init = conf.use_dumb_init
|
||||
self.base_tag = conf.base_tag
|
||||
self.tag = conf.tag
|
||||
self.repos_yaml = conf.repos_yaml
|
||||
self.base_arch = conf.base_arch
|
||||
self.debian_arch = self.base_arch
|
||||
if self.base_arch == 'aarch64':
|
||||
|
@ -829,6 +830,7 @@ class KollaWorker(object):
|
|||
'base_image': self.conf.base_image,
|
||||
'base_distro_tag': self.base_tag,
|
||||
'base_arch': self.base_arch,
|
||||
'repos_yaml': self.repos_yaml,
|
||||
'use_dumb_init': self.use_dumb_init,
|
||||
'base_package_type': self.base_package_type,
|
||||
'debian_arch': self.debian_arch,
|
||||
|
|
|
@ -91,7 +91,11 @@ def handle_repos(context, reponames, mode):
|
|||
if not isinstance(reponames, list):
|
||||
raise TypeError("First argument should be a list of repositories")
|
||||
|
||||
repofile = os.path.dirname(os.path.realpath(__file__)) + '/repos.yaml'
|
||||
if context.get('repos_yaml'):
|
||||
repofile = context.get('repos_yaml')
|
||||
else:
|
||||
repofile = os.path.dirname(os.path.realpath(__file__)) + '/repos.yaml'
|
||||
|
||||
with open(repofile, 'r') as repos_file:
|
||||
repo_data = {}
|
||||
for name, params in yaml.safe_load(repos_file).items():
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
features:
|
||||
- |
|
||||
Added an `--repos-yaml` argument to allow user to provide own file with
|
||||
definitions of external package repositories. Useful for those building
|
||||
in offline environments with set of internal mirrors.
|
Loading…
Reference in New Issue