avoid setting LOCALSTACK_CLI in the container #9223
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
#7906 introduced the
LOCALSTACK_CLI
env variable, which is only used as a workaround to indicate that we are currently in a CLI environment (other than an actual runtime environment).With #8307, we removed the install-dependency on
localstack_client
.We added a global env prefix
LOCALSTACK_
. All environment variables with this prefix will be added to the container (no matter if they are listed in theCONFIG_ENV_VARS
global variable). The intention for that is that we have a simple way of adding new variables which should be forwarded to a container without maintaining this global list.Unfortunately, since #8307 is merged, we set the
LOCALSTACK_CLI
also in LocalStack containers started by the CLI, which shouldn't be set.This PR fixes this.
Changes
LOCALSTACK_CLI
from theCONFIG_ENV_VARS
when populating it from the current environment.Testing
Unfortunately, this is really hard to test, since it's a change in
config.py
. TheLOCALSTACK_CLI
env var is only set later for our tests in theconftest.py
, which is why this change isn't even considered in our tests (the tests never even adds theLOCALSTACK_CLI
, since it's set after theCONFIG_ENV_VARS
are populated).I'm happy for any suggestions on how to properly test this...