cleanup: refactor deeply nested if statement in cephcsi.go

Refactored deeply nested if statement in cephcsi.go to
reduce cognitive complexity.

Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
Rakshith R 2021-04-04 12:18:03 +05:30 committed by mergify[bot]
parent aaeb35eceb
commit 7d105143fc

View File

@ -148,14 +148,13 @@ func main() {
} else { } else {
util.DefaultLog("Initial PID limit is set to %d", currentLimit) util.DefaultLog("Initial PID limit is set to %d", currentLimit)
err = util.SetPIDLimit(conf.PidLimit) err = util.SetPIDLimit(conf.PidLimit)
if err != nil { switch {
case err != nil:
klog.Errorf("Failed to set new PID limit to %d: %v", conf.PidLimit, err) klog.Errorf("Failed to set new PID limit to %d: %v", conf.PidLimit, err)
} else { case conf.PidLimit == -1:
s := "" util.DefaultLog("Reconfigured PID limit to %d (max)", conf.PidLimit)
if conf.PidLimit == -1 { default:
s = " (max)" util.DefaultLog("Reconfigured PID limit to %d", conf.PidLimit)
}
util.DefaultLog("Reconfigured PID limit to %d%s", conf.PidLimit, s)
} }
} }
} }