From 23817c1a833dc593343684b1c5c40914df0f7da2 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Mon, 26 Oct 2020 14:18:48 +0100 Subject: [PATCH] cleanup: do not panic on invalid drivername When the cephcsi executable receives an error when calling util.ValidateDriverName(), it panics due to klog.Fatalln(). The error that util.ValidateDriverName() returns should be understandable enough, so that users know what to investigate. A Go panic on a user error is not very userfriendly, and does not provide any additional usefil information. Signed-off-by: Niels de Vos --- cmd/cephcsi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/cephcsi.go b/cmd/cephcsi.go index 13896401a..22ab4a8e2 100644 --- a/cmd/cephcsi.go +++ b/cmd/cephcsi.go @@ -129,7 +129,7 @@ func main() { dname := getDriverName() err := util.ValidateDriverName(dname) if err != nil { - klog.Fatalln(err) // calls exit + logAndExit(err.Error()) } // the driver may need a higher PID limit for handling all concurrent requests