Skip to content

Commit 1a5d490

Browse files
committed
do not panic if ~/.kube/config is missing
1 parent 0b47e9c commit 1a5d490

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmd/mobile/main.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package main
1616

1717
import (
1818
"flag"
19+
"fmt"
1920
"os"
2021

2122
"k8s.io/client-go/kubernetes"
@@ -108,10 +109,13 @@ func main() {
108109
}
109110
}
110111

112+
// NewClientsOrDie creates a new set of clients for Kubernetes, Service Catalog and Mobile Services
113+
// if any of these clients fails to create then the process wil die.
111114
func NewClientsOrDie(configLoc string) (kubernetes.Interface, m.Interface, sc.Interface) {
112115
config, err := clientcmd.BuildConfigFromFlags("", configLoc)
113116
if err != nil {
114-
panic(err.Error())
117+
fmt.Fprintln(os.Stderr, err.Error())
118+
os.Exit(1)
115119
}
116120

117121
// create the K8client

0 commit comments

Comments
 (0)