From fbb09fc99098af587974569074497f6e21a51889 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 1 Jan 2022 19:27:39 +0200 Subject: fix crypttab? Sponsored-by: author --- vmdb/plugins/fstab_plugin.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/vmdb/plugins/fstab_plugin.py b/vmdb/plugins/fstab_plugin.py index 04c2312..9caeea3 100644 --- a/vmdb/plugins/fstab_plugin.py +++ b/vmdb/plugins/fstab_plugin.py @@ -62,9 +62,12 @@ class FstabStepRunner(vmdb.StepRunnerInterface): for entry in filesystems: fstab.write(line.format(**entry)) - crypttab_path = os.path.join(chroot, "etc/crypttab") - line = "{name} UUID={uuid} none luks,discard\n" - with open(crypttab_path, "w") as crypttab: - for entry in filesystems: - if "uuid" in entry and "name" in entry: + entries = [e for e in filesystems if "uuid" in e and "name" in e] + vmdb.progress(f"filesystems: {filesystems}") + vmdb.progress(f"crypttab entries: {entries}") + if entries: + crypttab_path = os.path.join(chroot, "etc/crypttab") + line = "{name} UUID={uuid} none luks,discard\n" + with open(crypttab_path, "w") as crypttab: + for entry in entries: crypttab.write(line.format(**entry)) -- cgit v1.2.1