Skip to content

Commit

Permalink
Support for Btrfs and XFS in parted and mkfs
Browse files Browse the repository at this point in the history
  • Loading branch information
brejoc authored and meaksh committed Mar 23, 2020
1 parent f7b4c38 commit fa34f4b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions salt/modules/parted_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,8 @@ def _is_fstype(fs_type):
:param fs_type: file system type
:return: True if fs_type is supported in this module, False otherwise
'''
return fs_type in set(['ext2', 'ext3', 'ext4', 'fat32', 'fat16', 'linux-swap', 'reiserfs',
'hfs', 'hfs+', 'hfsx', 'NTFS', 'ntfs', 'ufs'])
return fs_type in set(['btrfs', 'ext2', 'ext3', 'ext4', 'fat32', 'fat16', 'linux-swap', 'reiserfs',
'hfs', 'hfs+', 'hfsx', 'NTFS', 'ntfs', 'ufs', 'xfs'])


def mkfs(device, fs_type):
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/modules/test_parted_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,22 @@ def test_list__valid_unit_valid_legacy_cmd_output(self):
}
self.assertEqual(output, expected)

def test_btrfs_fstypes(self):
'''Tests if we see btrfs as valid fs type'''
with patch('salt.modules.parted_partition._validate_device', MagicMock()):
try:
parted.mkfs('/dev/foo', 'btrfs')
except CommandExecutionError:
self.fail("Btrfs is not in the supported fstypes")

def test_xfs_fstypes(self):
'''Tests if we see xfs as valid fs type'''
with patch('salt.modules.parted_partition._validate_device', MagicMock()):
try:
parted.mkfs('/dev/foo', 'xfs')
except CommandExecutionError:
self.fail("XFS is not in the supported fstypes")

def test_disk_set(self):
with patch('salt.modules.parted_partition._validate_device', MagicMock()):
self.cmdrun.return_value = ''
Expand Down

0 comments on commit fa34f4b

Please sign in to comment.