mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-24 02:04:13 +03:00
cloudinit: Move random password printing and sleeping to virt-install
Fixed: - Added a do_log flag to print_stdout(), to avoid logging of printed random password. - Excluded timeout in virt-install from testing Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
This commit is contained in:
parent
b4daeba6b5
commit
7ae6a60086
10
virt-install
10
virt-install
@ -9,6 +9,7 @@ import argparse
|
||||
import atexit
|
||||
import sys
|
||||
import time
|
||||
import select
|
||||
|
||||
import libvirt
|
||||
|
||||
@ -677,6 +678,15 @@ def start_install(guest, installer, options):
|
||||
if options.destroy_on_exit:
|
||||
atexit.register(_destroy_on_exit, domain)
|
||||
|
||||
passwd = installer.get_generated_password()
|
||||
if options.cloud_init and passwd: # pragma: no cover
|
||||
print_stdout(_("Password for first login is: %s") % passwd, do_log=False)
|
||||
print_stdout(
|
||||
_("Installation will continue in 10 seconds "
|
||||
"(press Enter to skip)"))
|
||||
timeout = 10
|
||||
select.select([sys.stdin], [], [], timeout)
|
||||
|
||||
cli.connect_console(guest, domain, conscb,
|
||||
waithandler.wait_for_console_to_exit,
|
||||
options.destroy_on_exit)
|
||||
|
@ -269,9 +269,10 @@ def fail(msg, do_exit=True):
|
||||
_fail_exit()
|
||||
|
||||
|
||||
def print_stdout(msg, do_force=False):
|
||||
log.debug(msg)
|
||||
if do_force or not get_global_state().quiet:
|
||||
def print_stdout(msg, do_force=False, do_log=True):
|
||||
if do_log:
|
||||
log.debug(msg)
|
||||
if do_force or not get_global_state().quiet or not do_log:
|
||||
print(msg)
|
||||
|
||||
|
||||
|
@ -431,6 +431,10 @@ class Installer(object):
|
||||
self._tmpfiles.append(iso)
|
||||
self._add_unattended_install_cdrom_device(guest, iso)
|
||||
|
||||
def get_generated_password(self):
|
||||
if self._cloudinit_data:
|
||||
return self._cloudinit_data.generate_password()
|
||||
|
||||
|
||||
##########################
|
||||
# guest install handling #
|
||||
|
Loading…
x
Reference in New Issue
Block a user