Merge pull request #926 from mwhudson/fix-ssh-option

fix --ssh option to client
This commit is contained in:
Michael Hudson-Doyle 2021-03-31 20:23:59 +13:00 committed by GitHub
commit 7111efbd61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 12 deletions

View File

@ -283,19 +283,16 @@ class SubiquityClient(TuiApplication):
self.interactive = status.interactive self.interactive = status.interactive
if self.interactive: if self.interactive:
if self.opts.ssh: if self.opts.ssh:
ssh_info = self.client.meta.ssh_info.GET() ssh_info = await self.client.meta.ssh_info.GET()
if ssh_info is None:
print("no ssh?")
return
texts = ssh_help_texts(ssh_info) texts = ssh_help_texts(ssh_info)
for line in texts: for line in texts:
if hasattr(line, 'text'): import urwid
if line.text.startswith('installer@'): if isinstance(line, urwid.Widget):
print(' ' * 4 + line.text) line = '\n'.join([
else: line.decode('utf-8').rstrip()
print(line.text) for line in line.render((1000,)).text
else: ])
print(line) print(line)
return return
await super().start() await super().start()
journald_listen( journald_listen(

View File

@ -148,7 +148,7 @@ def ssh_help_texts(ssh_info):
texts = [_(SSH_HELP_PROLOGUE), ""] texts = [_(SSH_HELP_PROLOGUE), ""]
if len(ssh_info.ips) > 0: if ssh_info is not None:
if len(ssh_info.ips) > 1: if len(ssh_info.ips) > 1:
texts.append(_(SSH_HELP_MULTIPLE_ADDRESSES)) texts.append(_(SSH_HELP_MULTIPLE_ADDRESSES))
texts.append("") texts.append("")