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

Improve error detection for zypper_call and add_suseconnect_product #10259

Merged
merged 3 commits into from
May 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/registration.pm
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ sub add_suseconnect_product {
record_soft_failure 'bsc#1124318 - Fail to get module repo metadata - running the command again as a workaround';
}
assert_script_run("SUSEConnect -p $name/$version/$arch $params", $timeout);
} elsif ($result && !$retry) {
die "SUSEConnect failed activating module $name with exit code (see log output): $result.";
}
}

Expand Down
9 changes: 9 additions & 0 deletions lib/utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -500,12 +500,21 @@ sub zypper_call {
$IN_ZYPPER_CALL = 1;
# Retrying workarounds
my $ret;
my $search_conflicts = 'awk \'BEGIN {print "Processing conflicts - ",NR; group=0}
/Solverrun finished with an ERROR/,/statistics/{ print group"|",
$0; if ($0 ~ /statistics/ ){ print "EOL"; group++ }; }\'\
/var/log/zypper.log
';
for (1 .. 5) {
$ret = script_run("zypper -n $command $printer; ( exit \${PIPESTATUS[0]} )", $timeout);
die "zypper did not finish in $timeout seconds" unless defined($ret);
if ($ret == 4) {
if (script_run('grep "Error code.*502" /var/log/zypper.log') == 0) {
die 'According to bsc#1070851 zypper should automatically retry internally. Bugfix missing for current product?';
} elsif (my $conflicts = script_output($search_conflicts)) {
record_info("Conflict", $conflicts, result => 'fail');
diag "Package conflicts found, not retrying anymore" if $conflicts;
last;
}
next unless get_var('FLAVOR', '') =~ /-(Updates|Incidents)$/;
}
Expand Down