diff options
author | Lars Wirzenius <liw@liw.fi> | 2022-01-01 10:36:58 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2022-01-01 21:59:41 +0200 |
commit | 55b4931b80b5b740f595efd82dc6bf0e9aceda5b (patch) | |
tree | 60e10932ae4bed1dad60e45fbcfd71db1648f288 /vmdb/plugins/mkfs_plugin.py | |
parent | d9956b88d68d881113bed48987e0f143f508be7a (diff) | |
download | vmdb2-55b4931b80b5b740f595efd82dc6bf0e9aceda5b.tar.gz |
feat: cryptsetup step
This adds a step to use cryptsetup to encrypt a block device with
LUKS, using the cryptsetup tool. A crypttab is written by the fstab
step.
Sponsored-by: author
Diffstat (limited to 'vmdb/plugins/mkfs_plugin.py')
-rw-r--r-- | vmdb/plugins/mkfs_plugin.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/vmdb/plugins/mkfs_plugin.py b/vmdb/plugins/mkfs_plugin.py index 83c6aff..7bb32b6 100644 --- a/vmdb/plugins/mkfs_plugin.py +++ b/vmdb/plugins/mkfs_plugin.py @@ -53,10 +53,25 @@ class MkfsStepRunner(vmdb.StepRunnerInterface): options = values["options"] or None if options: - for opt in options.split(' '): + for opt in options.split(" "): cmd.append(opt) cmd.append(device) vmdb.runcmd(cmd) + uuid = ( + vmdb.runcmd( + [ + "blkid", + "-c/dev/null", + "-ovalue", + "-sUUID", + device, + ] + ) + .decode() + .strip() + ) + state.tags.set_fstype(tag, fstype) + state.tags.set_fsuuid(tag, uuid) |