From 9bd3ea6a6cb56122389cefc55094a312e8d4ec6a Mon Sep 17 00:00:00 2001 From: Dan Bungert Date: Tue, 8 Feb 2022 15:38:07 -0700 Subject: [PATCH] filesystem: passphrase in answers, failing test --- examples/answers-guided-lvm.yaml | 1 + subiquity/client/controllers/filesystem.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/examples/answers-guided-lvm.yaml b/examples/answers-guided-lvm.yaml index f2652896..cbfc88a2 100644 --- a/examples/answers-guided-lvm.yaml +++ b/examples/answers-guided-lvm.yaml @@ -14,6 +14,7 @@ Filesystem: guided: yes guided-method: lvm guided-index: 0 + guided-passphrase: passw0rd Identity: realname: Ubuntu username: ubuntu diff --git a/subiquity/client/controllers/filesystem.py b/subiquity/client/controllers/filesystem.py index d80f8413..d1cffe29 100644 --- a/subiquity/client/controllers/filesystem.py +++ b/subiquity/client/controllers/filesystem.py @@ -89,10 +89,20 @@ class FilesystemController(SubiquityTuiController, FilesystemManipulator): [disk] = [d for d in self.ui.body.form.disks if d.label == label] method = self.answers.get('guided-method') - self.ui.body.form.guided_choice.value = { + value = { 'disk': disk, 'use_lvm': method == "lvm", } + passphrase = self.answers.get('guided-passphrase') + if passphrase is not None: + value['lvm_options'] = { + 'encrypt': True, + 'luks_options': { + 'password': passphrase, + 'confirm_password': passphrase, + } + } + self.ui.body.form.guided_choice.value = value self.ui.body.done(self.ui.body.form) await self.app.confirm_install() while not isinstance(self.ui.body, FilesystemView):