Make default context behaves like a real context:
- when using "--context default" parameter - when printing the list of contexts - when exporting the default context to a tarball Signed-off-by: Jean-Christophe Sirot <jean-christophe.sirot@docker.com> (+1 squashed commit) Squashed commits: [20670495] Fix CLI initialization for the `docker stack deploy --help` command and ensure that the dockerCli.CurrentContext() always returns a non empty context name (default as a fallback) Remove now obsolete code handling empty string context name Minor code cleanup Signed-off-by: Jean-Christophe Sirot <jean-christophe.sirot@docker.com>
This commit is contained in:
@ -224,3 +224,24 @@ func (c *FakeCli) NewContainerizedEngineClient(sockPath string) (clitypes.Contai
|
||||
func (c *FakeCli) SetContainerizedEngineClient(containerizedEngineClientFunc containerizedEngineFuncType) {
|
||||
c.containerizedEngineClientFunc = containerizedEngineClientFunc
|
||||
}
|
||||
|
||||
// StackOrchestrator return the selected stack orchestrator
|
||||
func (c *FakeCli) StackOrchestrator(flagValue string) (command.Orchestrator, error) {
|
||||
configOrchestrator := ""
|
||||
if c.configfile != nil {
|
||||
configOrchestrator = c.configfile.StackOrchestrator
|
||||
}
|
||||
ctxOrchestrator := ""
|
||||
if c.currentContext != "" && c.contextStore != nil {
|
||||
meta, err := c.contextStore.GetContextMetadata(c.currentContext)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
context, err := command.GetDockerContext(meta)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
ctxOrchestrator = string(context.StackOrchestrator)
|
||||
}
|
||||
return command.GetStackOrchestrator(flagValue, ctxOrchestrator, configOrchestrator, c.err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user