-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add support for podman --context default #9907
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
I think we need to check the value of and reject anything else than "default" with an error indicating that we don't support Swarm
cmd/podman/root.go
Outdated
@@ -269,6 +269,9 @@ func rootFlags(cmd *cobra.Command, opts *entities.PodmanConfig) { | |||
lFlags.StringVar(&opts.URI, urlFlagName, uri, "URL to access Podman service (CONTAINER_HOST)") | |||
_ = cmd.RegisterFlagCompletionFunc(urlFlagName, completion.AutocompleteDefault) | |||
|
|||
// Context option added just for compatibily with DockerCLI. | |||
lFlags.String("context", "", "Name of the context to use to connect to the daemon (This flag is a NOOP and provided solely for scripting compatibility.)") |
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.
default should be "default"
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.
I actually had that originally but was not crazy about it since it showed on the help message. But I can add it back.
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.
I think we should hide the flag and not document it. It doesn't add value since it only accepts one value. But I think it adds great value for cases as in the initial issue.
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.
SGTM
cmd/podman/root.go
Outdated
@@ -180,6 +180,10 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error { | |||
os.Setenv("TMPDIR", "/var/tmp") | |||
} | |||
|
|||
context := cmd.Root().LocalFlags().Lookup("context") | |||
if context.Value.String() != "default" { | |||
return errors.New("Podman does not support swarm, only --context value allowed is \"default\"") |
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.
soft suggestion
return errors.New("Podman does not support swarm, only --context value allowed is \"default\"") | |
return errors.New("Podman does not support swarm, the only --context value allowed is \"default\"") |
All kinds of unhappy tests. |
b2601ab
to
f3f1a9d
Compare
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.
LGTM, thanks!
This is a noop but helps with scripting and docker-compose. Fixes: containers#9806 Signed-off-by: Daniel J Walsh <[email protected]>
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.
/lgtm
This is a noop but helps with scripting and docker-compose.
Fixes: #9806
Signed-off-by: Daniel J Walsh [email protected]