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(); }