Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow non-interactive mode for trup_call commands #15847

Merged
merged 1 commit into from Nov 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 11 additions & 3 deletions lib/transactional.pm
Expand Up @@ -74,6 +74,10 @@ sub process_reboot {
$args{automated_rollback} //= 0;
$args{expected_grub} //= 1;

# Switch to root-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
select_console $prev_console;
}

# Reboot if there's a diff between the current FS and the new snapshot
Expand Down Expand Up @@ -165,15 +172,16 @@ sub trup_call {
$script .= "; echo trup-\$?- | tee -a /dev/$serialdev" unless $cmd =~ /reboot / && $args{exit_code} == 0;
script_run $script, 0;
if ($cmd =~ /pkg |ptf /) {
if (wait_serial "Continue?") {
if ($cmd =~ /(^|\s)-\w*n\w* pkg/) {
record_info 'non-interactive', 'The transactional-update command is in non-interactive mode';
} elsif (wait_serial "Continue?") {
Comment on lines +175 to +177
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish we could add a unit test for this kind of thing by extracting it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand :/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand :/

I mean, if we had the condition, in a sort routine, we could easily test the code, like we do for version_check for instance but we can think about this in the following weeks (I'm just making a note here)

send_key "ret";
# Abort update of broken package
if ($cmd =~ /\bup(date)?\b/ && $args{exit_code} == 1) {
die 'Abort dialog not shown' unless wait_serial('Abort');
send_key 'ret';
}
}
else {
} else {
die "Confirmation dialog not shown";
}
}
Expand Down