Skip to content
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

Clean up Breeze output for Docker context #38857

Merged
merged 2 commits into from
Apr 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions dev/breeze/src/airflow_breeze/utils/docker_command_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ def autodetect_docker_context():
# On Windows, some contexts are used for WSL2. We don't want to use those.
if context["DockerEndpoint"] == "npipe:////./pipe/dockerDesktopLinuxEngine":
continue
get_console().print(f"[info]Using {preferred_context_name} as context.[/]")
get_console().print(f"[info]Using {preferred_context_name!r} as context.[/]")
return preferred_context_name
fallback_context = next(iter(known_contexts))
get_console().print(
Expand All @@ -662,11 +662,9 @@ def get_and_use_docker_context(context: str):
if context == "autodetect":
context = autodetect_docker_context()
run_command(["docker", "context", "create", context], check=False)
output = run_command(["docker", "context", "use", context], check=False)
if output.returncode != 0:
get_console().print(
f"[warning] Could no use the context {context}. Continuing with current context[/]"
)
output = run_command(["docker", "context", "use", context], check=False, stdout=DEVNULL, stderr=DEVNULL)
if output.returncode:
get_console().print(f"[warning]Could no use context {context!r}. Continuing with current context[/]")
return context


Expand Down
Loading