Project

General

Profile

Actions

Tasks #71469

open

mgr/vol: improve readability in exception handling part of remove_subvolume

Added by Rishabh Dave 10 months ago. Updated 10 months ago.

Status:
Fix Under Review
Priority:
Normal
Assignee:
Category:
-
Target version:
-
% Done:

0%

Reviewed:
Affected Versions:
Component(FS):
mgr/volumes
Labels (FS):
Pull request ID:
Tags (freeform):
Merge Commit:
Fixed In:
Released In:
Upkeep Timestamp:

Description

Following elif clause is where readability can be improved -

        except VolumeException as ve:
            if ve.errno == -errno.EAGAIN and not force:
                ve = VolumeException(ve.errno, ve.error_str + " (use --force to override)")
                ret = self.volume_exception_to_retval(ve)
            elif not (ve.errno == -errno.ENOENT and force):
                ret = self.volume_exception_to_retval(ve)
        return ret

If (ve.errno -errno.ENOENT and force) is True, ret remains initiated to its default value (which is 0) and thus zero is returned. Neither we inform user why zero is retuned in this case and checking for boolean value of not (ve.errno -errno.ENOENT and force) makes code a bit complicated.

Actions #1

Updated by Rishabh Dave 10 months ago

  • Component(FS) mgr/volumes added
Actions #2

Updated by Rishabh Dave 10 months ago

  • Description updated (diff)
Actions #3

Updated by Rishabh Dave 10 months ago

  • Subject changed from mgr/vol: remove_subvolume can return zero even though exception was raised to mgr/vol: improve readability in exception handling part of remove_subvolume
  • Description updated (diff)
Actions #4

Updated by Rishabh Dave 10 months ago

  • Tracker changed from Bug to Tasks
  • Regression deleted (No)
  • Severity deleted (3 - minor)
Actions #5

Updated by Rishabh Dave 10 months ago

  • Status changed from In Progress to Fix Under Review
  • Pull request ID set to 63554
Actions

Also available in: Atom PDF