Skip to content

Commit

Permalink
Fix logic of safe mode guard on reformat.
Browse files Browse the repository at this point in the history
A type of None means no formatting. An exception is when there is a
blkid-reported type that blivet doesn't have special handling for,
in which case type will be None but the name attribute will reflect
the type reported by blkid. In this special case we treat the
formatting as though it had a non-None type.
  • Loading branch information
dwlehman committed Oct 4, 2019
1 parent 8fac471 commit 6175524
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/blivet.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def _reformat(self):
if self._device.format.type == fmt.type:
return

if safe_mode and self._device.format.type is None and self._device.format.name != get_format(None).name:
if safe_mode and self._device.format.type is not None or self._device.format.name != get_format(None).name:
raise BlivetAnsibleError("cannot remove existing formatting on volume '%s' in safe mode" % self._volume['name'])

if self._device.format.status:
Expand Down

0 comments on commit 6175524

Please sign in to comment.