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 <Peter.Hoyes@arm.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Peter Hoyes 2022-07-08 16:45:11 +02:00 committed by Jan Kiszka
parent 7647d7ad3e
commit 682db50916

View File

@ -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()))