From 4e400b5b25ed0ae052ba33c91b8ed7a787b01304 Mon Sep 17 00:00:00 2001 From: Michal Nasiadka Date: Tue, 16 Jun 2026 06:47:00 +0200 Subject: repos: Merge user-provided with default repos.yaml Change-Id: I7513f1ab627aa5137e16777ca6bee600e14a00e9 Signed-off-by: Michal Nasiadka --- kolla/template/methods.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'kolla/template/methods.py') 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') -- cgit v1.2.3