diff --git a/api/exec/stack_manager.go b/api/exec/stack_manager.go index 8ba6b357e..9b709ea28 100644 --- a/api/exec/stack_manager.go +++ b/api/exec/stack_manager.go @@ -23,27 +23,19 @@ func NewStackManager(binaryPath string) *StackManager { } // Login executes the docker login command against a list of registries (including DockerHub). -func (manager *StackManager) Login(dockerhub *portainer.DockerHub, registries []portainer.Registry, endpoint *portainer.Endpoint) error { +func (manager *StackManager) Login(dockerhub *portainer.DockerHub, registries []portainer.Registry, endpoint *portainer.Endpoint) { command, args := prepareDockerCommandAndArgs(manager.binaryPath, endpoint) for _, registry := range registries { if registry.Authentication { registryArgs := append(args, "login", "--username", registry.Username, "--password", registry.Password, registry.URL) - err := runCommandAndCaptureStdErr(command, registryArgs, nil) - if err != nil { - return err - } + runCommandAndCaptureStdErr(command, registryArgs, nil) } } if dockerhub.Authentication { dockerhubArgs := append(args, "login", "--username", dockerhub.Username, "--password", dockerhub.Password) - err := runCommandAndCaptureStdErr(command, dockerhubArgs, nil) - if err != nil { - return err - } + runCommandAndCaptureStdErr(command, dockerhubArgs, nil) } - - return nil } // Logout executes the docker logout command. diff --git a/api/http/handler/stack.go b/api/http/handler/stack.go index 3ad0ce7ae..86b597e40 100644 --- a/api/http/handler/stack.go +++ b/api/http/handler/stack.go @@ -772,13 +772,9 @@ func (handler *StackHandler) handleDeleteStack(w http.ResponseWriter, r *http.Re func (handler *StackHandler) deployStack(config *stackDeploymentConfig) error { handler.stackCreationMutex.Lock() - err := handler.StackManager.Login(config.dockerhub, config.registries, config.endpoint) - if err != nil { - handler.stackCreationMutex.Unlock() - return err - } + handler.StackManager.Login(config.dockerhub, config.registries, config.endpoint) - err = handler.StackManager.Deploy(config.stack, config.prune, config.endpoint) + err := handler.StackManager.Deploy(config.stack, config.prune, config.endpoint) if err != nil { handler.stackCreationMutex.Unlock() return err diff --git a/api/portainer.go b/api/portainer.go index e898d2909..9304b199a 100644 --- a/api/portainer.go +++ b/api/portainer.go @@ -380,7 +380,7 @@ type ( // StackManager represents a service to manage stacks. StackManager interface { - Login(dockerhub *DockerHub, registries []Registry, endpoint *Endpoint) error + Login(dockerhub *DockerHub, registries []Registry, endpoint *Endpoint) Logout(endpoint *Endpoint) error Deploy(stack *Stack, prune bool, endpoint *Endpoint) error Remove(stack *Stack, endpoint *Endpoint) error