mirror of https://github.com/docker/cli.git
Update deploy.go
Clarified ambiguous error message Update kubernetes/cli.go Infromed user of why the error was caused when file is not there Signed-off-by: Justyn Temme <justyntemme@gmail.com>
This commit is contained in:
parent
9e71207327
commit
bdd58a4096
|
@ -81,7 +81,7 @@ func RunDeploy(dockerCli command.Cli, flags *pflag.FlagSet, config *composetypes
|
||||||
case commonOrchestrator.HasKubernetes():
|
case commonOrchestrator.HasKubernetes():
|
||||||
kli, err := kubernetes.WrapCli(dockerCli, kubernetes.NewOptions(flags, commonOrchestrator))
|
kli, err := kubernetes.WrapCli(dockerCli, kubernetes.NewOptions(flags, commonOrchestrator))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return errors.Wrap(err, "unable to deploy to Kubernetes")
|
||||||
}
|
}
|
||||||
return kubernetes.RunDeploy(kli, opts, config)
|
return kubernetes.RunDeploy(kli, opts, config)
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -4,10 +4,12 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/docker/cli/cli/command"
|
"github.com/docker/cli/cli/command"
|
||||||
"github.com/docker/cli/kubernetes"
|
"github.com/docker/cli/kubernetes"
|
||||||
cliv1beta1 "github.com/docker/cli/kubernetes/client/clientset/typed/compose/v1beta1"
|
cliv1beta1 "github.com/docker/cli/kubernetes/client/clientset/typed/compose/v1beta1"
|
||||||
|
"github.com/pkg/errors"
|
||||||
flag "github.com/spf13/pflag"
|
flag "github.com/spf13/pflag"
|
||||||
kubeclient "k8s.io/client-go/kubernetes"
|
kubeclient "k8s.io/client-go/kubernetes"
|
||||||
restclient "k8s.io/client-go/rest"
|
restclient "k8s.io/client-go/rest"
|
||||||
|
@ -58,7 +60,10 @@ func WrapCli(dockerCli command.Cli, opts Options) (*KubeCli, error) {
|
||||||
cli.kubeNamespace = opts.Namespace
|
cli.kubeNamespace = opts.Namespace
|
||||||
if opts.Namespace == "" {
|
if opts.Namespace == "" {
|
||||||
configNamespace, _, err := clientConfig.Namespace()
|
configNamespace, _, err := clientConfig.Namespace()
|
||||||
if err != nil {
|
switch {
|
||||||
|
case os.IsNotExist(err), os.IsPermission(err):
|
||||||
|
return nil, errors.Wrap(err, "unable to load configuration file")
|
||||||
|
case err != nil:
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
cli.kubeNamespace = configNamespace
|
cli.kubeNamespace = configNamespace
|
||||||
|
|
Loading…
Reference in New Issue