Skip to content

Commit

Permalink
Remove redundant check for parents in Blivet.newBTRFS.
Browse files Browse the repository at this point in the history
We already check parent type in BTRFSSubVolumeDevice, but we should be
using BTRFSValueError if those checks fail.

(cherry picked from commit 58884e4)

Resolves: rhbz#1072285
  • Loading branch information
dwlehman committed May 29, 2015
1 parent 1a07236 commit ad176cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
5 changes: 0 additions & 5 deletions blivet/__init__.py
Expand Up @@ -1223,11 +1223,6 @@ def newBTRFS(self, *args, **kwargs):

if kwargs.pop("subvol", False):
dev_class = BTRFSSubVolumeDevice
# make sure there's a valid parent device
parents = kwargs.get("parents", [])
if not parents or len(parents) != 1 or \
not isinstance(parents[0], BTRFSVolumeDevice):
raise ValueError("new btrfs subvols require a parent volume")

# set up the subvol name, using mountpoint if necessary
if not name:
Expand Down
4 changes: 2 additions & 2 deletions blivet/devices/btrfs.py
Expand Up @@ -434,10 +434,10 @@ def __init__(self, *args, **kwargs):
super(BTRFSSubVolumeDevice, self).__init__(*args, **kwargs)

if len(self.parents) != 1:
raise errors.DeviceError("%s %s must have exactly one parent." % (self.type, self.name))
raise errors.BTRFSValueError("%s %s must have exactly one parent." % self.type)

if not isinstance(self.parents[0], BTRFSDevice):
raise errors.DeviceError("%s %s's unique parent must be a BTRFSDevice." % (self.type, self.name))
raise errors.BTRFSValueError("%s %s's unique parent must be a BTRFSDevice." % self.type)

self.volume._addSubVolume(self)

Expand Down

0 comments on commit ad176cb

Please sign in to comment.