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

[MDBF-800][Postfix] - fix minor upgrade all #596

Merged
merged 10 commits into from
Oct 18, 2024
12 changes: 9 additions & 3 deletions scripts/bash_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,13 @@ rpm_pkg_makecache() {
# Try several times, to avoid sporadic "The requested URL returned error: 404"
made_cache=0
for i in {1..5}; do
sudo rm -rf "/var/cache/$pkg_cmd/*"
sudo "$pkg_cmd" clean all
if [[ $ID_LIKE =~ ^suse* ]]; then
sudo rm -rf "/var/cache/zypp/*"
sudo "$pkg_cmd" clean --all
else
sudo rm -rf "/var/cache/$pkg_cmd/*"
sudo "$pkg_cmd" clean all
fi
source /etc/os-release
if [[ $ID == "rhel" ]]; then
sudo subscription-manager refresh
Expand Down Expand Up @@ -210,7 +215,8 @@ rpm_repoquery() {
set +u
# return full package list from repository
if [[ $ID_LIKE =~ ^suse* ]]; then
zypper packages -r "${repo_name}" | grep "MariaDB" | awk '{print $8}'
sudo zypper --gpg-auto-import-keys packages -r "${repo_name}">/dev/null
fauust marked this conversation as resolved.
Show resolved Hide resolved
zypper packages -r "${repo_name}" | grep "MariaDB" | awk '{print $4}' #After cache is made, no need for sudo
else
repoquery --disablerepo=* --enablerepo="${repo_name}" -a -q |
cut -d ":" -f1 | sort -u | sed 's/-0//'
Expand Down
16 changes: 11 additions & 5 deletions scripts/rpm-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,16 @@ bb_log_info "Package_list: $package_list"
# sudo rm -rf
# /etc/zypp/repos.d/SUSE_Linux_Enterprise_Server_12_SP3_x86_64:SLES12-SP3-Updates.repo
# /etc/zypp/repos.d/SUSE_Linux_Enterprise_Server_12_SP3_x86_64:SLES12-SP3-Pool.repo
sudo "$pkg_cmd" clean all
if [[ $ID_LIKE =~ ^suse* ]]; then
sudo "$pkg_cmd" clean --all
pkg_cmd_nonint="-n"
else
sudo "$pkg_cmd" clean all
pkg_cmd_nonint="-y"
RazvanLiviuVarzaru marked this conversation as resolved.
Show resolved Hide resolved
fi

# Install previous release
echo "$package_list" | xargs sudo "$pkg_cmd" -y install ||
echo "$package_list" | xargs sudo "$pkg_cmd" "$pkg_cmd_nonint" install ||
bb_log_err "installation of a previous release failed, see the output above"
#fi

Expand Down Expand Up @@ -246,18 +252,18 @@ fi
if [[ $test_type == "major" ]]; then
bb_log_info "remove old packages for major upgrade"
packages_to_remove=$(rpm -qa | grep 'MariaDB-' | awk -F'-' '{print $1"-"$2}')
echo "$packages_to_remove" | xargs sudo "$pkg_cmd" -y remove
echo "$packages_to_remove" | xargs sudo "$pkg_cmd" "$pkg_cmd_nonint" remove
rpm -qa | grep -iE 'maria|mysql' || true
fi

rpm_setup_bb_galera_artifacts_mirror
rpm_setup_bb_artifacts_mirror
if [[ $test_type == "major" ]]; then
# major upgrade (remove then install)
echo "$package_list" | xargs sudo "$pkg_cmd" -y install
echo "$package_list" | xargs sudo "$pkg_cmd" "$pkg_cmd_nonint" install
else
# minor upgrade (upgrade works)
echo "$package_list" | xargs sudo "$pkg_cmd" -y upgrade
echo "$package_list" | xargs sudo "$pkg_cmd" "$pkg_cmd_nonint" upgrade
fi
# set +e

Expand Down
Loading