From c506cfb7c05c8f4875c6e45b77a02e107bd1caea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20R=C5=AF=C5=BEi=C4=8Dka?= Date: Wed, 20 Nov 2024 15:55:42 +0100 Subject: [PATCH] Update tapnet.pm --- lib/tapnet.pm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/tapnet.pm b/lib/tapnet.pm index 1153d953..829a37f6 100644 --- a/lib/tapnet.pm +++ b/lib/tapnet.pm @@ -6,6 +6,8 @@ use base 'Exporter'; use Exporter; use testapi; +use utils; + our @EXPORT = qw/clone_host_file setup_tap_static get_host_dns/; my $self = shift; @@ -32,12 +34,15 @@ sub setup_tap_static { # for the system with a static IP address and possibly a specific # hostname - # It seems that this counts on being on root console, - # however, if we are not there, switch first. + # It is possible on certain tests that this will be running while + # we are inside a graphical session. In this case we need to switch + # to the console before we proceed with the network settings. my $console = 0; unless (check_screen("root_console")) { $console = 1; - $self->root_console(tty => 3); + send_key("ctrl-alt-f3"); + wait_still_screen(5); + console_login(user => "root"); } my $ip = shift; my $hostname = shift || ""; @@ -63,7 +68,8 @@ sub setup_tap_static { assert_script_run "nmcli con up '$connection'"; # for debugging assert_script_run "nmcli -t con show '$connection'"; - # If we have switched here from graphics, go back there. + # If we have switched to console from a graphical + # environment, here we come back to it. if ($console) { desktop_vt(); }