cli/command/service: use stdlib errors
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@ -2,11 +2,11 @@ package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/moby/moby/api/types/filters"
|
||||
"github.com/moby/moby/api/types/swarm"
|
||||
"github.com/moby/moby/client"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// ParseSecrets retrieves the secrets with the requested names and fills
|
||||
@ -20,7 +20,7 @@ func ParseSecrets(ctx context.Context, apiClient client.SecretAPIClient, request
|
||||
|
||||
for _, secret := range requestedSecrets {
|
||||
if _, exists := secretRefs[secret.File.Name]; exists {
|
||||
return nil, errors.Errorf("duplicate secret target for %s not allowed", secret.SecretName)
|
||||
return nil, fmt.Errorf("duplicate secret target for %s not allowed", secret.SecretName)
|
||||
}
|
||||
secretRef := new(swarm.SecretReference)
|
||||
*secretRef = *secret
|
||||
@ -49,7 +49,7 @@ func ParseSecrets(ctx context.Context, apiClient client.SecretAPIClient, request
|
||||
for _, ref := range secretRefs {
|
||||
id, ok := foundSecrets[ref.SecretName]
|
||||
if !ok {
|
||||
return nil, errors.Errorf("secret not found: %s", ref.SecretName)
|
||||
return nil, fmt.Errorf("secret not found: %s", ref.SecretName)
|
||||
}
|
||||
|
||||
// set the id for the ref to properly assign in swarm
|
||||
@ -98,7 +98,7 @@ func ParseConfigs(ctx context.Context, apiClient client.ConfigAPIClient, request
|
||||
}
|
||||
|
||||
if _, exists := configRefs[config.File.Name]; exists {
|
||||
return nil, errors.Errorf("duplicate config target for %s not allowed", config.ConfigName)
|
||||
return nil, fmt.Errorf("duplicate config target for %s not allowed", config.ConfigName)
|
||||
}
|
||||
|
||||
configRefs[config.File.Name] = configRef
|
||||
@ -129,7 +129,7 @@ func ParseConfigs(ctx context.Context, apiClient client.ConfigAPIClient, request
|
||||
for _, ref := range configRefs {
|
||||
id, ok := foundConfigs[ref.ConfigName]
|
||||
if !ok {
|
||||
return nil, errors.Errorf("config not found: %s", ref.ConfigName)
|
||||
return nil, fmt.Errorf("config not found: %s", ref.ConfigName)
|
||||
}
|
||||
|
||||
// set the id for the ref to properly assign in swarm
|
||||
@ -144,7 +144,7 @@ func ParseConfigs(ctx context.Context, apiClient client.ConfigAPIClient, request
|
||||
for _, ref := range runtimeRefs {
|
||||
id, ok := foundConfigs[ref.ConfigName]
|
||||
if !ok {
|
||||
return nil, errors.Errorf("config not found: %s", ref.ConfigName)
|
||||
return nil, fmt.Errorf("config not found: %s", ref.ConfigName)
|
||||
}
|
||||
|
||||
ref.ConfigID = id
|
||||
|
||||
Reference in New Issue
Block a user