Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jerome-quere authored and remyleone committed May 12, 2020
1 parent 891121e commit bdcf196
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
11 changes: 1 addition & 10 deletions internal/namespaces/registry/v1/custom_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,9 @@ func registryLoginRun(ctx context.Context, argsI interface{}) (i interface{}, e
return nil, fmt.Errorf("could not get secret key")
}

var cmdArgs []string

switch program(args.Program) {
case docker, podman:
cmdArgs = []string{"login", "-u", "scaleway", "--password-stdin", endpoint}
default:
return nil, fmt.Errorf("unknown program")
}

cmdArgs := []string{"login", "-u", "scaleway", "--password-stdin", endpoint}
cmd := exec.Command(args.Program, cmdArgs...)
cmd.Stdin = bytes.NewBufferString(secretKey)

exitCode, err := core.ExecCmd(ctx, cmd)

if err != nil {
Expand Down
13 changes: 3 additions & 10 deletions internal/namespaces/registry/v1/custom_logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,10 @@ func registryLogoutRun(ctx context.Context, argsI interface{}) (i interface{}, e
}
endpoint := endpointPrefix + region + endpointSuffix

var cmdArgs []string

switch program(args.Program) {
case docker, podman:
cmdArgs = []string{"logout", endpoint}
default:
return nil, fmt.Errorf("unknown program")
}

cmdArgs := []string{"logout", endpoint}
cmd := exec.Command(args.Program, cmdArgs...)
exitCode, err := core.ExecCmd(ctx, cmd)

if err != nil {
return nil, err
}
Expand All @@ -69,6 +62,6 @@ func registryLogoutRun(ctx context.Context, argsI interface{}) (i interface{}, e
}

return &core.SuccessResult{
Empty: true, // the program will output the sucess message
Empty: true, // the program will output the success message
}, nil
}

0 comments on commit bdcf196

Please sign in to comment.