Skip to content

Commit

Permalink
Allow non-interactive mode for trup_call commands
Browse files Browse the repository at this point in the history
Do not rely on root-console when transactional::trup_call command starts with -n parameter.
Switch to root-console in the beginning of transactional::process_reboot and back at the end.
  • Loading branch information
pdostal committed Nov 7, 2022
1 parent 5283b86 commit d5d1338
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/transactional.pm
Expand Up @@ -74,6 +74,10 @@ sub process_reboot {
$args{automated_rollback} //= 0;
$args{expected_grub} //= 1;

# Switch to roo-console as we need VNC to check for grub and for login prompt
my $prev_console = current_console();
select_console 'root-console', await_console => 0;

handle_first_grub if ($args{automated_rollback});

if (is_microos || is_sle_micro && !is_s390x) {
Expand Down Expand Up @@ -102,6 +106,9 @@ sub process_reboot {
select_console 'root-console';
assert_script_run 'clear';
}

# Switch to the previous console
($prev_console) ? select_console($prev_console) : die('The $prev_console is not defined.');
}

# Reboot if there's a diff between the current FS and the new snapshot
Expand Down Expand Up @@ -172,8 +179,9 @@ sub trup_call {
die 'Abort dialog not shown' unless wait_serial('Abort');
send_key 'ret';
}
}
else {
} elsif ($cmd =~ /^-n/) {
record_info 'non-interactive', 'The transactional-update command is in non-interactive mode';
} else {
die "Confirmation dialog not shown";
}
}
Expand Down

0 comments on commit d5d1338

Please sign in to comment.