aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xkolla/common/config.py2
-rwxr-xr-xkolla/image/build.py2
-rw-r--r--kolla/template/methods.py6
-rw-r--r--releasenotes/notes/user-provided-repos.yaml-d6e8583e9d9d01ef.yaml6
4 files changed, 15 insertions, 1 deletions
diff --git a/kolla/common/config.py b/kolla/common/config.py
index 1cfdebdd3..78c9f2fcd 100755
--- a/kolla/common/config.py
+++ b/kolla/common/config.py
@@ -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 = [
diff --git a/kolla/image/build.py b/kolla/image/build.py
index 0808afc84..f87c43292 100755
--- a/kolla/image/build.py
+++ b/kolla/image/build.py
@@ -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,
diff --git a/kolla/template/methods.py b/kolla/template/methods.py
index 4426512bb..94d72401b 100644
--- a/kolla/template/methods.py
+++ b/kolla/template/methods.py
@@ -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():
diff --git a/releasenotes/notes/user-provided-repos.yaml-d6e8583e9d9d01ef.yaml b/releasenotes/notes/user-provided-repos.yaml-d6e8583e9d9d01ef.yaml
new file mode 100644
index 000000000..98e41ec3f
--- /dev/null
+++ b/releasenotes/notes/user-provided-repos.yaml-d6e8583e9d9d01ef.yaml
@@ -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.