cleanup: refactor deeply nested if statements in internal/rbd

Refactored deeply nested if statement in internal/rbd to
reduce cognitive complexity.

Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
Rakshith R
2021-04-05 10:10:00 +05:30
committed by mergify[bot]
parent d4cfd7bef9
commit 020cded581
5 changed files with 79 additions and 77 deletions

View File

@ -277,10 +277,10 @@ func (rv *rbdVolume) Exists(ctx context.Context, parentVol *rbdVolume) (bool, er
// Need to check cloned info here not on createvolume,
if parentVol != nil {
found, cErr := rv.checkCloneImage(ctx, parentVol)
if found && cErr == nil {
switch {
case found && cErr == nil:
return true, nil
}
if cErr != nil {
case cErr != nil:
return false, cErr
}
}