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

View File

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