Review comments
This commit is contained in:
parent
5be2961a62
commit
760fbaa22f
|
@ -20,7 +20,7 @@ import shlex
|
|||
import sys
|
||||
|
||||
from subiquitycore.controller import BaseController
|
||||
from subiquitycore.ssh import host_key_info
|
||||
from subiquitycore.ssh import host_key_info, get_ips_standalone
|
||||
from subiquitycore.utils import disable_console_conf, run_command
|
||||
|
||||
from console_conf.ui.views import IdentityView, LoginView
|
||||
|
@ -108,21 +108,6 @@ def write_login_details(fp, username, ips):
|
|||
first_ip=first_ip,
|
||||
version=version))
|
||||
|
||||
def get_ips_standalone():
|
||||
from probert.prober import Prober
|
||||
from subiquitycore.models.network import NETDEV_IGNORED_IFACE_TYPES
|
||||
prober = Prober()
|
||||
prober.probe_network()
|
||||
links = prober.get_results()['network']['links']
|
||||
ips = []
|
||||
for l in sorted(links, key=lambda l: l['netlink_data']['name']):
|
||||
if l['type'] in NETDEV_IGNORED_IFACE_TYPES:
|
||||
continue
|
||||
for addr in l['addresses']:
|
||||
if addr['scope'] == "global":
|
||||
ips.append(addr['address'].split('/')[0])
|
||||
return ips
|
||||
|
||||
|
||||
def write_login_details_standalone():
|
||||
owner = get_device_owner()
|
||||
|
|
|
@ -164,9 +164,11 @@ def main():
|
|||
logging.getLogger('block-discover').addHandler(handler)
|
||||
|
||||
if opts.ssh:
|
||||
from subiquity.ui.views.help import ssh_help_texts, get_installer_password
|
||||
from console_conf.controllers.identity import get_ips_standalone
|
||||
texts = ssh_help_texts(get_ips_standalone(), get_installer_password(opts.dry_run))
|
||||
from subiquity.ui.views.help import (
|
||||
ssh_help_texts, get_installer_password)
|
||||
from subiquitycore.ssh import get_ips_standalone
|
||||
texts = ssh_help_texts(
|
||||
get_ips_standalone(), get_installer_password(opts.dry_run))
|
||||
for line in texts:
|
||||
if hasattr(line, 'text'):
|
||||
if line.text.startswith('installer@'):
|
||||
|
|
|
@ -124,6 +124,7 @@ Unfortunately the installer was unable to detect the password that has
|
|||
been set.
|
||||
""")
|
||||
|
||||
|
||||
def ssh_help_texts(ips, password):
|
||||
|
||||
texts = [_(SSH_HELP_PROLOGUE), ""]
|
||||
|
|
|
@ -75,3 +75,19 @@ def host_key_info():
|
|||
fingerprint=fingerprint,
|
||||
width=longest_type))
|
||||
return "".join(lines)
|
||||
|
||||
|
||||
def get_ips_standalone():
|
||||
from probert.prober import Prober
|
||||
from subiquitycore.models.network import NETDEV_IGNORED_IFACE_TYPES
|
||||
prober = Prober()
|
||||
prober.probe_network()
|
||||
links = prober.get_results()['network']['links']
|
||||
ips = []
|
||||
for l in sorted(links, key=lambda l: l['netlink_data']['name']):
|
||||
if l['type'] in NETDEV_IGNORED_IFACE_TYPES:
|
||||
continue
|
||||
for addr in l['addresses']:
|
||||
if addr['scope'] == "global":
|
||||
ips.append(addr['address'].split('/')[0])
|
||||
return ips
|
||||
|
|
Loading…
Reference in New Issue