Skip to content

Commit

Permalink
Merge pull request #8 from warm-metal/fix-version
Browse files Browse the repository at this point in the history
no fail on connection failure while version running
  • Loading branch information
kitt1987 committed Jan 26, 2021
1 parent fb8e27e commit 7c5bbb5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkg/cmd/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ limitations under the License.
package cmd

import (
"fmt"
"github.com/spf13/cobra"
"github.com/warm-metal/kubectl-dev/pkg/cmd/build"
"github.com/warm-metal/kubectl-dev/pkg/cmd/opts"
"github.com/warm-metal/kubectl-dev/pkg/dev"
"github.com/warm-metal/kubectl-dev/pkg/kubectl"
"k8s.io/cli-runtime/pkg/genericclioptions"
"os"
)

func NewCmdDev(streams genericclioptions.IOStreams) *cobra.Command {
Expand All @@ -47,13 +49,17 @@ kubectl dev build install --minikube
# Build image in cluster using docker parameters and options.
kubectl dev build -t foo:tag -f Dockerfile .`,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
PersistentPreRun: func(cmd *cobra.Command, args []string) {
clientset, err := o.ClientSet()
if err != nil {
return err
fmt.Fprintf(os.Stderr, "can't connect to the cluster. actions may fail. %s\n", err)
return
}

return dev.Prepare(clientset, o.DevNamespace)
if err = dev.Prepare(clientset, o.DevNamespace); err != nil {
fmt.Fprintf(os.Stderr, "can't initialize the dev runtime: %s\n", err)
return
}
},
}

Expand Down

0 comments on commit 7c5bbb5

Please sign in to comment.