diff --git a/examples/answers.yaml b/examples/answers.yaml index e05fa2cf..1691103f 100644 --- a/examples/answers.yaml +++ b/examples/answers.yaml @@ -17,6 +17,8 @@ Identity: hostname: ubuntu-server # ubuntu password: '$6$wdAcoXrU039hKYPd$508Qvbe7ObUnxoj15DRCkzC3qO7edjH0VV7BPNRDYK4QR8ofJaEEF2heacn0QgD.f8pO8SNp83XNdWG6tocBM1' + ssh_import_id: lp:mwhudson + accept-ssh-key: true InstallProgress: reboot: yes diff --git a/subiquity/controllers/identity.py b/subiquity/controllers/identity.py index 67291f14..7cf281c5 100644 --- a/subiquity/controllers/identity.py +++ b/subiquity/controllers/identity.py @@ -45,9 +45,12 @@ class IdentityController(BaseController): 'username': self.answers['username'], 'hostname': self.answers['hostname'], 'password': self.answers['password'], - #'ssh_import_id': self.answers.get('ssh-import-id', ''), } - self.done(d) + if 'ssh_import_id' in self.answers: + ssh_import_id = self.answers['ssh_import_id'] + self.fetch_ssh_keys(d, ssh_import_id) + else: + self.done(d) def cancel(self): self.signal.emit_signal('prev-screen') @@ -87,7 +90,11 @@ class IdentityController(BaseController): if result is not None: ok, result, ssh_key, fingerprint = result if ok: - self.ui.frame.body.confirm_ssh_keys(result, ssh_key, fingerprint) + if self.answers.get('accept-ssh-key'): + result['ssh_key'] = ssh_key + self.loop.set_alarm_in(0.0, lambda loop, ud: self.done(result)) + else: + self.ui.frame.body.confirm_ssh_keys(result, ssh_key, fingerprint) def fetch_ssh_keys(self, result, ssh_import_id): self._fetching_proc = run_command_start(['ssh-import-id', '-o-', ssh_import_id])