From f1ce5bcccd779479c054203e9c4a7e5dbd0b7a4c Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Wed, 12 Dec 2018 14:15:20 +1300 Subject: [PATCH] answers support --- subiquity/controllers/ssh.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/subiquity/controllers/ssh.py b/subiquity/controllers/ssh.py index 9deb5573..29083b17 100644 --- a/subiquity/controllers/ssh.py +++ b/subiquity/controllers/ssh.py @@ -38,8 +38,20 @@ class SSHController(BaseController): def default(self): self.ui.set_body(SSHView(self.model, self)) - # if self.answers: - # self.done(self.answers) + if self.answers: + d = { + "install_server": self.answers.get("install", False), + "authorized_keys": self.answers.get("authorized_keys", []), + "pwauth": self.answers.get("pwauth", True), + } + self.done(d) + elif 'ssh-import-id' in self.all_answers.get('Identity', {}): + import_id = self.all_answers['Identity']['ssh-import-id'] + d = { + "install_server": True, + "pwauth": True, + } + self.fetch_ssh_keys(d, import_id) def cancel(self): self.signal.emit_signal('prev-screen') @@ -88,7 +100,7 @@ class SSHController(BaseController): # Happens if the fetch is cancelled. return user_spec, key_material, fingerprints = result - if 'ssh-import-id' in self.answers: + if 'ssh-import-id' in self.all_answers.get("Identity", {}): user_spec['ssh_keys'] = key_material.splitlines() self.loop.set_alarm_in(0.0, lambda loop, ud: self.done(user_spec))