fix --ssh option to client

This commit is contained in:
Michael Hudson-Doyle 2021-03-31 20:18:22 +13:00
parent 26593f4c16
commit afe21993d9
2 changed files with 9 additions and 12 deletions

View File

@ -283,19 +283,16 @@ 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:
print(line)
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()
journald_listen(

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("")