Skip to content

Commit

Permalink
rebase fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Ferquel <[email protected]>
  • Loading branch information
simonferquel committed Nov 23, 2018
1 parent 7f1765c commit d81004d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
4 changes: 1 addition & 3 deletions cli/command/context/create.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package context

import (
"os"

"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/context/docker"
Expand Down Expand Up @@ -48,7 +46,7 @@ func (o *createOptions) addFlags(flags *pflag.FlagSet) {
}

func (o *createOptions) process(cli command.Cli, s store.Store) error {
if _, err := s.GetContextMetadata(o.name); !os.IsNotExist(err) {
if _, err := s.GetContextMetadata(o.name); !store.IsErrContextDoesNotExist(err) {
if err != nil {
return errors.Wrap(err, "error while getting existing contexts")
}
Expand Down
6 changes: 3 additions & 3 deletions cli/command/context/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ func newExportCommand(dockerCli command.Cli) *cobra.Command {
}
func runExport(dockerCli command.Cli, opts *exportOptions) error {
ctxMeta, err := dockerCli.ContextStore().GetContextMetadata(opts.contextName)
if err != nil {
return err
}
var writer io.Writer
if opts.dest == "-" {
writer = dockerCli.Out()
Expand All @@ -59,9 +62,6 @@ func runExport(dockerCli command.Cli, opts *exportOptions) error {
writer = f
}

if err != nil {
return err
}
if !opts.kubeconfig {
reader := store.Export(opts.contextName, dockerCli.ContextStore())
defer reader.Close()
Expand Down
4 changes: 3 additions & 1 deletion cli/command/context/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ func newImportCommand(dockerCli command.Cli) *cobra.Command {
return err
}
if opts.use {
return dockerCli.ContextStore().SetCurrentContext(opts.name)
cfg := dockerCli.ConfigFile()
cfg.CurrentContext = opts.name
return cfg.Save()
}
return nil
},
Expand Down
4 changes: 3 additions & 1 deletion cli/command/context/use.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ func newUseCommand(dockerCli command.Cli) *cobra.Command {
if _, err := dockerCli.ContextStore().GetContextMetadata(name); err != nil {
return err
}
return dockerCli.ContextStore().SetCurrentContext(name)
cfg := dockerCli.ConfigFile()
cfg.CurrentContext = name
return cfg.Save()
},
}
return cmd
Expand Down

0 comments on commit d81004d

Please sign in to comment.