From 3e305970df58c6c9a56d957aece0e2e6bebf8df9 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 when validateCloneDepthFlag() detects an error When the cephcsi executable receives an error when calling validateCloneDepthFlag(), it panics due to klog.Fatalln(). The errors that validateCloneDepthFlag() logs 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/cephcsi.go b/cmd/cephcsi.go index 7ef318c5d..d135e31a4 100644 --- a/cmd/cephcsi.go +++ b/cmd/cephcsi.go @@ -191,11 +191,11 @@ func main() { func validateCloneDepthFlag(conf *util.Config) { // keeping hardlimit to 14 as max to avoid max image depth if conf.RbdHardMaxCloneDepth == 0 || conf.RbdHardMaxCloneDepth > 14 { - klog.Fatalln("rbdhardmaxclonedepth flag value should be between 1 and 14") + logAndExit("rbdhardmaxclonedepth flag value should be between 1 and 14") } if conf.RbdSoftMaxCloneDepth > conf.RbdHardMaxCloneDepth { - klog.Fatalln("rbdsoftmaxclonedepth flag value should not be greater than rbdhardmaxclonedepth") + logAndExit("rbdsoftmaxclonedepth flag value should not be greater than rbdhardmaxclonedepth") } }