diff options
author | rtkapiper <andy.piper@arcticwolf.com> | 2023-07-11 17:42:31 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2023-07-13 06:29:50 +0000 |
commit | dd8b1aa211181afb653bb36d5767d6c6b728e84d (patch) | |
tree | 711ef769c2dd7606e54247492af1383d8114eba8 | |
parent | 8ea3ce04ac5fec917b0bd498c4723e37ae003a92 (diff) | |
download | vmdb2-dd8b1aa211181afb653bb36d5767d6c6b728e84d.tar.gz |
fstab_plugin: sort fstab entries by mount point
Sort entries that are written to `/etc/fstab` by mount_point. This
ensures that the entries are listed in dependency order, allowing for
all mountpoints to be mounted by `mount -a` in a single pass. For
example, this is useful when the mount points `/`, `/boot`, and
`/boot/efi` are all defined in `/etc/fstab`
-rw-r--r-- | vmdb/plugins/fstab_plugin.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/vmdb/plugins/fstab_plugin.py b/vmdb/plugins/fstab_plugin.py index b52d306..182d225 100644 --- a/vmdb/plugins/fstab_plugin.py +++ b/vmdb/plugins/fstab_plugin.py @@ -68,6 +68,8 @@ class FstabStepRunner(vmdb.StepRunnerInterface): } ) + # Ensure the entries are in dependency order + filesystems.sort(key=lambda x: x['mount_point']) fstab_path = os.path.join(chroot, "etc/fstab") line = "UUID={uuid} {mount_point} {fstype} defaults 0 1\n" with open(fstab_path, "w") as fstab: |