Remove use of deprecated IsErr...NotFound checks

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2017-10-03 11:38:15 +02:00
parent 448d56a491
commit 532a3942d6
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
3 changed files with 5 additions and 5 deletions

View File

@ -54,7 +54,7 @@ func runInspect(dockerCli command.Cli, opts inspectOptions) error {
getRef := func(ref string) (interface{}, []byte, error) { getRef := func(ref string) (interface{}, []byte, error) {
// Service inspect shows defaults values in empty fields. // Service inspect shows defaults values in empty fields.
service, _, err := client.ServiceInspectWithRaw(ctx, ref, types.ServiceInspectOptions{InsertDefaults: true}) service, _, err := client.ServiceInspectWithRaw(ctx, ref, types.ServiceInspectOptions{InsertDefaults: true})
if err == nil || !apiclient.IsErrServiceNotFound(err) { if err == nil || !apiclient.IsErrNotFound(err) {
return service, nil, err return service, nil, err
} }
return nil, nil, errors.Errorf("Error: no such service: %s", ref) return nil, nil, errors.Errorf("Error: no such service: %s", ref)
@ -62,7 +62,7 @@ func runInspect(dockerCli command.Cli, opts inspectOptions) error {
getNetwork := func(ref string) (interface{}, []byte, error) { getNetwork := func(ref string) (interface{}, []byte, error) {
network, _, err := client.NetworkInspectWithRaw(ctx, ref, types.NetworkInspectOptions{Scope: "swarm"}) network, _, err := client.NetworkInspectWithRaw(ctx, ref, types.NetworkInspectOptions{Scope: "swarm"})
if err == nil || !apiclient.IsErrNetworkNotFound(err) { if err == nil || !apiclient.IsErrNotFound(err) {
return network, nil, err return network, nil, err
} }
return nil, nil, errors.Errorf("Error: no such network: %s", ref) return nil, nil, errors.Errorf("Error: no such network: %s", ref)

View File

@ -102,7 +102,7 @@ func runLogs(dockerCli *command.DockerCli, opts *logsOptions) error {
} }
task, _, err := cli.TaskInspectWithRaw(ctx, opts.target) task, _, err := cli.TaskInspectWithRaw(ctx, opts.target)
if err != nil { if err != nil {
if client.IsErrTaskNotFound(err) { if client.IsErrNotFound(err) {
// if the task isn't found, rewrite the error to be clear // if the task isn't found, rewrite the error to be clear
// that we looked for services AND tasks and found none // that we looked for services AND tasks and found none
err = fmt.Errorf("no such task or service: %v", opts.target) err = fmt.Errorf("no such task or service: %v", opts.target)

View File

@ -222,7 +222,7 @@ func createSecrets(
if err := client.SecretUpdate(ctx, secret.ID, secret.Meta.Version, secretSpec); err != nil { if err := client.SecretUpdate(ctx, secret.ID, secret.Meta.Version, secretSpec); err != nil {
return errors.Wrapf(err, "failed to update secret %s", secretSpec.Name) return errors.Wrapf(err, "failed to update secret %s", secretSpec.Name)
} }
case apiclient.IsErrSecretNotFound(err): case apiclient.IsErrNotFound(err):
// secret does not exist, then we create a new one. // secret does not exist, then we create a new one.
if _, err := client.SecretCreate(ctx, secretSpec); err != nil { if _, err := client.SecretCreate(ctx, secretSpec); err != nil {
return errors.Wrapf(err, "failed to create secret %s", secretSpec.Name) return errors.Wrapf(err, "failed to create secret %s", secretSpec.Name)
@ -249,7 +249,7 @@ func createConfigs(
if err := client.ConfigUpdate(ctx, config.ID, config.Meta.Version, configSpec); err != nil { if err := client.ConfigUpdate(ctx, config.ID, config.Meta.Version, configSpec); err != nil {
errors.Wrapf(err, "failed to update config %s", configSpec.Name) errors.Wrapf(err, "failed to update config %s", configSpec.Name)
} }
case apiclient.IsErrConfigNotFound(err): case apiclient.IsErrNotFound(err):
// config does not exist, then we create a new one. // config does not exist, then we create a new one.
if _, err := client.ConfigCreate(ctx, configSpec); err != nil { if _, err := client.ConfigCreate(ctx, configSpec); err != nil {
errors.Wrapf(err, "failed to create config %s", configSpec.Name) errors.Wrapf(err, "failed to create config %s", configSpec.Name)