kas: Eliminate Context.keep_config flag

This variable was only set in the shell plugin to disable the normal
behaviour of the FinishSetupRepos step. We can achieve the same result
by not adding the FinishSetupRepos step when we wish to keep the config
in the build environment unchanged.

Signed-off-by: Paul Barker <pbarker@konsulko.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Paul Barker 2020-11-13 19:34:49 +01:00 committed by Jan Kiszka
parent e6d1d1718d
commit c408e89ef1
3 changed files with 5 additions and 9 deletions

View File

@ -74,7 +74,6 @@ class Context:
self.__kas_work_dir = os.environ.get('KAS_WORK_DIR', os.getcwd())
self.__kas_repo_ref_dir = os.environ.get('KAS_REPO_REF_DIR', None)
self.setup_initial_environ()
self.keep_config = False
self.config = None
self.args = args

View File

@ -339,12 +339,10 @@ class FinishSetupRepos(Command):
def execute(self, ctx):
""" TODO refactor protected-access """
# now fetch everything with complete config and check out layers
# except if keep_config is set
if not ctx.keep_config:
repos_fetch(ctx.config.get_repos())
repos_fetch(ctx.config.get_repos())
for repo in ctx.config.get_repos():
repo.checkout()
for repo in ctx.config.get_repos():
repo.checkout()
logging.debug('Configuration from config file:\n%s',
pprint.pformat(ctx.config._config))

View File

@ -91,15 +91,14 @@ class Shell:
if 'SSH_PRIVATE_KEY' in os.environ:
macro.add(SetupSSHAgent())
ctx.keep_config = args.keep_config_unchanged
macro.add(InitSetupRepos())
repo_loop = Loop('repo_setup_loop')
repo_loop.add(SetupReposStep())
macro.add(repo_loop)
macro.add(FinishSetupRepos())
if not args.keep_config_unchanged:
macro.add(FinishSetupRepos())
macro.add(SetupEnviron())
macro.add(SetupHome())