Fix Azure login : allow getting a backend when no corresponding context already exists with an explicit call from the login command. Will be usefull next for context creation with azure interactive things

This commit is contained in:
Guillaume Tardif 2020-05-28 17:37:59 +02:00
parent 832651b1dc
commit 01aaec2dbe
8 changed files with 84 additions and 62 deletions

View file

@ -5,7 +5,6 @@ import (
"github.com/spf13/cobra"
"github.com/docker/api/client"
apicontext "github.com/docker/api/context"
)
// Command returns the compose command with its child commands
@ -24,12 +23,12 @@ func azureLoginCommand() *cobra.Command {
azureLoginCmd := &cobra.Command{
Use: "azure",
RunE: func(cmd *cobra.Command, args []string) error {
ctx := apicontext.WithCurrentContext(cmd.Context(), "aci")
c, err := client.New(ctx)
ctx := cmd.Context()
cs, err := client.GetCloudService(ctx, "aci")
if err != nil {
return errors.Wrap(err, "cannot connect to backend")
}
return c.CloudService().Login(ctx, nil)
return cs.Login(ctx, nil)
},
}