-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
fix config.dirs usage in the CLI #7906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
LocalStack integration with Pro 1 files - 2 1 suites - 2 1h 45m 59s ⏱️ + 10m 14s Results for commit 0496c40. ± Comparison against base commit 762339a. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes are looking good, I only added a minor nitpick. It's great to see this behavior being fixed. I'm really looking forward to extracting the CLI from the runtime and properly isolate the two.
But it seems there is a small thing missing: The pipeline is red because the LocalstackContainer
class expects the config.dirs.tmp
to be present for writing the logs (which is now is not anymore). As soon as this is fixed, we're good to go from my perspective!
localstack/cli/main.py
Outdated
# indicate to the environment we are starting from the CLI | ||
os.environ["LOCALSTACK_CLI"] = "1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This module should only be loaded if the CLI is started, but maybe this should still be moved to the main function body to ensure that this cannot be set accidentally by importing this module?
good catch @alexrashed, pushed a fix for your comments |
b3002c8
to
0496c40
Compare
This PR adds a band-aid to a long-standing issue that
config.dirs
is used when running CLI commands.This caused localstack to create the
.filesystem
directory in the Python path, which was originally just designed for executing host mode in developer environments, even when simply using the CLI.Because the CLI and the runtime share control paths, there are situations where values from
config.dirs
are used to create directories or files, even though they may not make sense in the context of the CLI.dirs.cache
is used by the analytics metadata (cache machine id file), and was used by theget_service_catalog
call (now removed)dirs.data
is used bylocalstack_ext.config
(this will be removed)dirs.logs
is used as target to put the logs of the docker run command when starting localstackdirs.tmp
should be removed now, but left it in there just in caseThere is now a special control path that populates
config.dirs
deliberately with values that make the above examples work without the.filesystem
directory.To reduce the number of calls to
config.dirs
, I also removed some unused code from the startup procedure.Once the old edge proxy logic is removed, we can more easily split up
infra.py
and thereforebootstrap.py
, which will hopefuly also make it easier to separate out the CLI code.