fix: make nodatacow and compress mutually exclusive (#1998)

* fix: make nodatacow and compress mutually exclusive

* fix: raise ValueError when both compress and nodatacow flags are set
This commit is contained in:
Himadri Bhattacharjee 2023-09-16 23:21:08 +00:00 committed by GitHub
parent 47ed711743
commit f4a6d11373
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -412,12 +412,18 @@ class SubvolumeModification:
mountpoint = Path(entry['mountpoint']) if entry['mountpoint'] else None
compress = entry.get('compress', False)
nodatacow = entry.get('nodatacow', False)
if compress and nodatacow:
raise ValueError('compress and nodatacow flags cannot be enabled simultaneously on a btfrs subvolume')
mods.append(
SubvolumeModification(
entry['name'],
mountpoint,
entry.get('compress', False),
entry.get('nodatacow', False)
compress,
nodatacow
)
)

View File

@ -46,7 +46,6 @@ class SubvolumeMenu(ListManager):
['nodatacow', 'compress'],
skip=True,
preset_values=preset_options,
multi=True
).run()
if choice.type_ == MenuSelectionType.Selection: