mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-17 11:50:18 +00:00
cleanup: prevent Go panic on missing driver type
When running the 'cephcsi' executable without arguments, a Go panic is reported: $ ./_output/cephcsi F1026 13:59:04.302740 3409054 cephcsi.go:126] driver type not specified goroutine 1 [running]: k8s.io/klog/v2.stacks(0xc000010001, 0xc0000520a0, 0x48, 0x9a) /go/src/github.com/ceph/ceph-csi/vendor/k8s.io/klog/v2/klog.go:996 +0xb9 k8s.io/klog/v2.(*loggingT).output(0x2370360, 0xc000000003, 0x0, 0x0, 0xc000194770, 0x20cb265, 0xa, 0x7e, 0x413500) /go/src/github.com/ceph/ceph-csi/vendor/k8s.io/klog/v2/klog.go:945 +0x191 k8s.io/klog/v2.(*loggingT).println(0x2370360, 0x3, 0x0, 0x0, 0xc000163e08, 0x1, 0x1) /go/src/github.com/ceph/ceph-csi/vendor/k8s.io/klog/v2/klog.go:699 +0x11a k8s.io/klog/v2.Fatalln(...) /go/src/github.com/ceph/ceph-csi/vendor/k8s.io/klog/v2/klog.go:1456 main.main() /go/src/github.com/ceph/ceph-csi/cmd/cephcsi.go:126 +0xafa Just logging the error and exiting should be sufficient. This stack-trace from the Go panic does not add any useful information. Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
7101a6dc8e
commit
79e91fa894
@ -123,7 +123,7 @@ func main() {
|
||||
util.DefaultLog("Driver version: %s and Git version: %s", util.DriverVersion, util.GitCommit)
|
||||
|
||||
if conf.Vtype == "" {
|
||||
klog.Fatalln("driver type not specified")
|
||||
logAndExit("driver type not specified")
|
||||
}
|
||||
|
||||
dname := getDriverName()
|
||||
|
Loading…
Reference in New Issue
Block a user