Skip to content

Commit

Permalink
fixup! fixup! Add a preliminary checker to ensure the mount points in…
Browse files Browse the repository at this point in the history
… /etc/fstab are in the correct order
  • Loading branch information
Mikhail Sandakov committed Nov 26, 2024
1 parent fc2bdf6 commit 900507a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pleskdistup/common/src/mounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ def get_fstab_configuration_misorderings(configpath: str) -> typing.List[typing.
if mount_points_order["/"] > mount_points_order[mount_point]:
misorderings.append(("/", mount_point))

leading_paths = mount_point.split("/")[:-1]
for i in range(1, len(leading_paths) + 1):
parent_dir = "/".join(leading_paths[:i])
if parent_dir in mount_points_order and mount_points_order[parent_dir] > mount_points_order[mount_point]:
misorderings.append((parent_dir, mount_point))
parant_dir = os.path.dirname(mount_point)
while parant_dir != "/":
if parant_dir in mount_points_order and mount_points_order[parant_dir] > mount_points_order[mount_point]:
misorderings.append((parant_dir, mount_point))
parant_dir = os.path.dirname(parant_dir)

return misorderings

0 comments on commit 900507a

Please sign in to comment.