@@ -12,6 +12,7 @@ import (
1212 "github.com/docker/docker/api/types/container"
1313 "github.com/docker/docker/api/types/swarm"
1414 apiclient "github.com/docker/docker/client"
15+ "github.com/docker/docker/errdefs"
1516 "github.com/pkg/errors"
1617)
1718
@@ -85,7 +86,7 @@ func validateExternalNetworks(ctx context.Context, client apiclient.NetworkAPICl
8586 }
8687 network , err := client .NetworkInspect (ctx , networkName , types.NetworkInspectOptions {})
8788 switch {
88- case apiclient . IsErrNotFound (err ):
89+ case errdefs . IsNotFound (err ):
8990 return errors .Errorf ("network %q is declared as external, but could not be found. You need to create a swarm-scoped network before the stack is deployed" , networkName )
9091 case err != nil :
9192 return err
@@ -107,7 +108,7 @@ func createSecrets(ctx context.Context, dockerCli command.Cli, secrets []swarm.S
107108 if err := client .SecretUpdate (ctx , secret .ID , secret .Meta .Version , secretSpec ); err != nil {
108109 return errors .Wrapf (err , "failed to update secret %s" , secretSpec .Name )
109110 }
110- case apiclient . IsErrNotFound (err ):
111+ case errdefs . IsNotFound (err ):
111112 // secret does not exist, then we create a new one.
112113 fmt .Fprintf (dockerCli .Out (), "Creating secret %s\n " , secretSpec .Name )
113114 if _ , err := client .SecretCreate (ctx , secretSpec ); err != nil {
@@ -131,7 +132,7 @@ func createConfigs(ctx context.Context, dockerCli command.Cli, configs []swarm.C
131132 if err := client .ConfigUpdate (ctx , config .ID , config .Meta .Version , configSpec ); err != nil {
132133 return errors .Wrapf (err , "failed to update config %s" , configSpec .Name )
133134 }
134- case apiclient . IsErrNotFound (err ):
135+ case errdefs . IsNotFound (err ):
135136 // config does not exist, then we create a new one.
136137 fmt .Fprintf (dockerCli .Out (), "Creating config %s\n " , configSpec .Name )
137138 if _ , err := client .ConfigCreate (ctx , configSpec ); err != nil {
0 commit comments