cleanup: add logAndExit() for cephcsi:main() to call instead of panic

The main() function of the cephcsi executable calls klog.Fatalln() to
report certain errors. This causes the executable to panic which is not
helpful to users that only need the error message.

By introducing logAndExit(), there is no need to call klog.Fatalln()
anymore.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2020-10-27 08:13:30 +01:00 committed by mergify[bot]
parent 9732cf16a1
commit 7101a6dc8e

View File

@ -208,3 +208,8 @@ func validateMaxSnaphostFlag(conf *util.Config) {
klog.Fatalln("maxsnapshotsonimage flag value should be between 1 and 500")
}
}
func logAndExit(msg string) {
klog.Errorln(msg)
os.Exit(1)
}