From 682db509160acc71ab902d5284b82d04768ea443 Mon Sep 17 00:00:00 2001 From: Peter Hoyes Date: Fri, 8 Jul 2022 16:45:11 +0200 Subject: [PATCH] libcmds: Remove protected accesses to Config There is one remaining protected access in SetupReposStep: an assignment to ctx.config._config. Replace this with a call to ctx.config.find_missing_repos, which already handles this assignment. Remove the TODO comment. There is one remaining protected access in FinishSetupRepos: a read of ctx.config._config for debugging purposes. Replace this with a call to ctx.config.get_config(). Remove the TODO comment. Signed-off-by: Peter Hoyes Signed-off-by: Jan Kiszka --- kas/libcmds.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/kas/libcmds.py b/kas/libcmds.py index d1641e5..8104aa9 100644 --- a/kas/libcmds.py +++ b/kas/libcmds.py @@ -359,7 +359,6 @@ class SetupReposStep(Command): return 'setup_repos_step' def execute(self, ctx): - """ TODO refactor protected-access """ if not ctx.missing_repo_names: return False @@ -389,8 +388,8 @@ class SetupReposStep(Command): in ctx.config.repo_dict} ctx.missing_repo_names_old = ctx.missing_repo_names - (ctx.config._config, ctx.missing_repo_names) = \ - ctx.config.handler.get_config(repos=repo_paths) + ctx.missing_repo_names = \ + ctx.config.find_missing_repos(repo_paths) return ctx.missing_repo_names @@ -404,7 +403,6 @@ class FinishSetupRepos(Command): return 'finish_setup_repos' def execute(self, ctx): - """ TODO refactor protected-access """ # now fetch everything with complete config and check out layers repos_fetch(ctx.config.get_repos()) @@ -412,4 +410,4 @@ class FinishSetupRepos(Command): repo.checkout() logging.debug('Configuration from config file:\n%s', - pprint.pformat(ctx.config._config)) + pprint.pformat(ctx.config.get_config()))