diff options
| author | Michal Nasiadka <mnasiadka@gmail.com> | 2026-06-16 06:47:00 +0200 |
|---|---|---|
| committer | Michal Nasiadka <mnasiadka@gmail.com> | 2026-06-16 12:44:12 +0000 |
| commit | 4e400b5b25ed0ae052ba33c91b8ed7a787b01304 (patch) | |
| tree | 97dcedc1d7884ea3d9353f2237c916b622eb18a4 | |
| parent | 4530208a92df98b69a5cd906e23623ee9ddc386f (diff) | |
| download | kolla-4e400b5b25ed0ae052ba33c91b8ed7a787b01304.tar.gz kolla-4e400b5b25ed0ae052ba33c91b8ed7a787b01304.zip | |
repos: Merge user-provided with default repos.yaml
Change-Id: I7513f1ab627aa5137e16777ca6bee600e14a00e9
Signed-off-by: Michal Nasiadka <mnasiadka@gmail.com>
| -rw-r--r-- | kolla/common/config.py | 2 | ||||
| -rw-r--r-- | kolla/template/methods.py | 19 |
2 files changed, 12 insertions, 9 deletions
diff --git a/kolla/common/config.py b/kolla/common/config.py index c4ebcbf3b..0d6e70aa6 100644 --- a/kolla/common/config.py +++ b/kolla/common/config.py @@ -256,7 +256,7 @@ _CLI_OPTS = [ cfg.StrOpt('image-name-prefix', default='', help='Prefix prepended to image names'), cfg.StrOpt('repos-yaml', default='', - help='Path to alternative repos.yaml file'), + help='Path to repos.yaml override file'), cfg.StrOpt('engine', default='docker', choices=['docker', 'podman'], help='Container engine to build images on.'), cfg.StrOpt('podman_base_url', default='unix:///run/podman/podman.sock', diff --git a/kolla/template/methods.py b/kolla/template/methods.py index 42b7399bb..5dbf8da1b 100644 --- a/kolla/template/methods.py +++ b/kolla/template/methods.py @@ -108,15 +108,18 @@ def handle_repos(context, reponames, mode): if not isinstance(reponames, list): raise TypeError("First argument should be a list of repositories") + default_repofile = os.path.dirname( + os.path.realpath(__file__)) + '/repos.yaml' + with open(default_repofile, 'r') as repos_file: + repo_data = yaml.safe_load(repos_file) + 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(): - repo_data[name] = params + with open(context.get('repos_yaml'), 'r') as repos_file: + for section, repos in yaml.safe_load(repos_file).items(): + if section in repo_data: + repo_data[section].update(repos) + else: + repo_data[section] = repos base_package_type = context.get('base_package_type') base_distro = context.get('base_distro') |
