mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
virt-install: Don't pause for cloudinit pass if stdin is closed
Like if run in a script without any stdin open. Have the test suite actually hit this path Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
226378d522
commit
c5da0d7b07
@ -879,6 +879,7 @@ c.add_compare("--disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init root-pass
|
|||||||
c.add_compare("--disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init root-password-file=%(ADMIN-PASSWORD-FILE)s,disable=no", "cloud-init-options") # --cloud-init root-password-file
|
c.add_compare("--disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init root-password-file=%(ADMIN-PASSWORD-FILE)s,disable=no", "cloud-init-options") # --cloud-init root-password-file
|
||||||
c.add_compare("--disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init ssh-key=%(XMLDIR)s/cloudinit/ssh-key.txt", "cloud-init-options") # --cloud-init ssh-key
|
c.add_compare("--disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init ssh-key=%(XMLDIR)s/cloudinit/ssh-key.txt", "cloud-init-options") # --cloud-init ssh-key
|
||||||
c.add_compare("--disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init user-data=%(XMLDIR)s/cloudinit/user-data.txt,meta-data=%(XMLDIR)s/cloudinit/meta-data.txt", "cloud-init-options") # --cloud-init user-data=,meta-data=
|
c.add_compare("--disk %(EXISTIMG1)s --os-variant fedora28 --cloud-init user-data=%(XMLDIR)s/cloudinit/user-data.txt,meta-data=%(XMLDIR)s/cloudinit/meta-data.txt", "cloud-init-options") # --cloud-init user-data=,meta-data=
|
||||||
|
c.add_valid("--connect %(URI-KVM)s --disk %(EXISTIMG1)s --install fedora28 --cloud-init", grep="Password for first root login") # make sure we print the root login password
|
||||||
c.add_valid("--panic help --disk=? --check=help", grep="path_in_use") # Make sure introspection doesn't blow up
|
c.add_valid("--panic help --disk=? --check=help", grep="path_in_use") # Make sure introspection doesn't blow up
|
||||||
c.add_valid("--connect test:///default --test-stub-command", use_default_args=False) # --test-stub-command
|
c.add_valid("--connect test:///default --test-stub-command", use_default_args=False) # --test-stub-command
|
||||||
c.add_valid("--nodisks --pxe", grep="VM performance may suffer") # os variant warning
|
c.add_valid("--nodisks --pxe", grep="VM performance may suffer") # os variant warning
|
||||||
|
36
virt-install
36
virt-install
@ -630,6 +630,30 @@ class WaitHandler:
|
|||||||
return (time_elapsed >= self._wait_secs) or cli.in_testsuite()
|
return (time_elapsed >= self._wait_secs) or cli.in_testsuite()
|
||||||
|
|
||||||
|
|
||||||
|
def _print_cloudinit_passwd(installer):
|
||||||
|
passwd = installer.get_generated_password()
|
||||||
|
if not passwd:
|
||||||
|
return
|
||||||
|
|
||||||
|
print_stdout(_("Password for first root login is: %s") % passwd,
|
||||||
|
do_force=True, do_log=False)
|
||||||
|
|
||||||
|
stdins = [sys.stdin]
|
||||||
|
timeout = 10
|
||||||
|
if sys.stdin.closed or not sys.stdin.isatty():
|
||||||
|
if not cli.in_testsuite(): # pragma: no cover
|
||||||
|
return
|
||||||
|
stdins = []
|
||||||
|
timeout = .0001
|
||||||
|
|
||||||
|
sys.stdout.write(
|
||||||
|
_("Installation will continue in 10 seconds "
|
||||||
|
"(press Enter to skip)..."))
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
select.select(stdins, [], [], timeout)
|
||||||
|
|
||||||
|
|
||||||
def start_install(guest, installer, options):
|
def start_install(guest, installer, options):
|
||||||
autoconsole = cli.parse_autoconsole(options, guest)
|
autoconsole = cli.parse_autoconsole(options, guest)
|
||||||
show_console_warnings(installer, autoconsole)
|
show_console_warnings(installer, autoconsole)
|
||||||
@ -645,8 +669,7 @@ def start_install(guest, installer, options):
|
|||||||
|
|
||||||
waithandler = WaitHandler(options.wait)
|
waithandler = WaitHandler(options.wait)
|
||||||
meter = cli.get_meter()
|
meter = cli.get_meter()
|
||||||
log.debug("Guest.has_install_phase: %s",
|
log.debug("Guest.has_install_phase: %s", installer.has_install_phase())
|
||||||
installer.has_install_phase())
|
|
||||||
|
|
||||||
# we've got everything -- try to start the install
|
# we've got everything -- try to start the install
|
||||||
print_stdout(_("\nStarting install..."))
|
print_stdout(_("\nStarting install..."))
|
||||||
@ -662,14 +685,7 @@ def start_install(guest, installer, options):
|
|||||||
if options.destroy_on_exit:
|
if options.destroy_on_exit:
|
||||||
atexit.register(_destroy_on_exit, domain)
|
atexit.register(_destroy_on_exit, domain)
|
||||||
|
|
||||||
passwd = installer.get_generated_password()
|
_print_cloudinit_passwd(installer)
|
||||||
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,
|
cli.connect_console(guest, domain, conscb,
|
||||||
waithandler.wait_for_console_to_exit,
|
waithandler.wait_for_console_to_exit,
|
||||||
|
Loading…
Reference in New Issue
Block a user