shell: Add option to keep current environment

When doing interactive development via kas shell it is often desirable
to keep the user's customized configuration. The new --preserve-env
argument has been added to support this scenario via an opt in flag.

This flag is blocked  when not running from a TTY or via kas-container
and kas issues a warning to the user about potential unintended side
effects when invoked.

Signed-off-by: Ryan Fairfax <rfairfax@linux.microsoft.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Ryan Fairfax
2022-02-23 02:02:01 +01:00
committed by Jan Kiszka
parent 3d35fe2f60
commit 32514c8f4f
3 changed files with 36 additions and 1 deletions

View File

@@ -148,6 +148,14 @@ class SetupHome(Command):
Sets up the home directory of kas.
"""
# A list of environment variables that SETUP_HOME uses
# This should be kept up to date with any code in execute()
ENV_VARS = [
'GIT_CREDENTIAL_HELPER',
'AWS_CONFIG_FILE',
'AWS_SHARED_CREDENTIALS_FILE',
]
def __init__(self):
super().__init__()
self.tmpdirname = tempfile.mkdtemp()