diff --git a/pleskdistup/common/src/mounts.py b/pleskdistup/common/src/mounts.py index 86b22f7..b4451b0 100644 --- a/pleskdistup/common/src/mounts.py +++ b/pleskdistup/common/src/mounts.py @@ -32,7 +32,7 @@ def get_fstab_configuration_misorderings(configpath: str) -> typing.List[typing. misorderings: typing.List[typing.Tuple[str, str]] = [] for mount_point in mount_points_order.keys(): - if mount_point == "/": + if mount_point == "/" or not mount_point.startswith("/"): continue parent_dir: str = mount_point diff --git a/pleskdistup/common/tests/mountstests.py b/pleskdistup/common/tests/mountstests.py index ea6aabc..a0d60ff 100644 --- a/pleskdistup/common/tests/mountstests.py +++ b/pleskdistup/common/tests/mountstests.py @@ -81,3 +81,12 @@ def test_file_without_root(self): f.write("devpts /dev/pts devpts gid=5,mode=620 0 0\n") f.write("tmpfs /dev/shm tmpfs defaults 0 0\n") self.assertEqual(mounts.get_fstab_configuration_misorderings(self.test_file_path), [("/home", "/home/test")]) + + def test_mount_point_is_swap(self): + with open(self.test_file_path, "w") as f: + f.write("# comment\n") + f.write("/dev/sda2 /var ext4 defaults 0 1\n") + f.write("/dev/sda5 swap swap defaults 0 1\n") + f.write("/dev/sda4 /home ext4 defaults 0 1\n") + + self.assertEqual(mounts.get_fstab_configuration_misorderings(self.test_file_path), [])