Uh oh!
There was an error while loading. Please reload this page.
cli/command/context: "docker context show": don't validate context - #3886
Conversation
| _, err := dockerCli.ContextStore().GetMetadata(context) | ||
| if err != nil { | ||
| return err | ||
| } |
There was a problem hiding this comment.
From the discussion on #3868 (comment)
As this is a new command, we can still change; do we think we should produce an error at all if the context wasn't found, or just "show the name of the context" (basically: this is what's configured to use, but you'll learn if it works once you use it)?
We could still opt for printing the error (on STDERR) as a warning, but make the command always return a zero exit code ("success").
Codecov Report
Additional details and impacted files@@ Coverage Diff @@## master #3886 +/- ##
==========================================
+ Coverage 59.22% 59.23% +0.01%
==========================================
Files 285 287 +2 Lines 24653 24651 -2 ==========================================
+ Hits 14601 14603 +2 + Misses 9168 9166 -2 + Partials 884 882 -2 |
The "docker context show" command is intended to show the currently configured context. While the context that's configured may not be valid (e.g., in case an environment variable was set to configure the context, or if the context was removed from the filesystem), we should still be able to _show_ the context. This patch removes the context validation, and instead only shows the context. This can help in cases where the context is used to (e.g.) set the command- prompt, but the user removed the context. With this change, the context name can still be shown, but commands that _require_ the context will still fail. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
3348a5e to
6ba7de3ComparethaJeztah
commented
Nov 28, 2022
Thx! Bringing this one in. We'll probably need to do follow-ups to align compose-cli with the changes we made in the cli itself. |
The "docker context show" command is intended to show the currently configured
context. While the context that's configured may not be valid (e.g., in case
an environment variable was set to configure the context, or if the context
was removed from the filesystem), we should still be able to show the
context.
This patch removes the context validation, and instead only shows the context.
This can help in cases where the context is used to (e.g.) set the command-
prompt, but the user removed the context. With this change, the context name
can still be shown, but commands that require the context will still fail.
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)