1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-12-22 02:13:08 +00:00

Factor out s/metalink/mirrorlist/ into a util function

We do this in quite a few places and need to do it in another,
so let's just have a function for it. It takes a file glob
so we can have it run on a different one for _live_build.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2019-08-20 14:16:23 -07:00
parent d4206ee732
commit a177a63ec1
3 changed files with 14 additions and 8 deletions

View File

@ -7,7 +7,7 @@ use Exporter;
use lockapi;
use testapi;
our @EXPORT = qw/run_with_error_check type_safely type_very_safely desktop_vt boot_to_login_screen console_login console_switch_layout desktop_switch_layout console_loadkeys_us do_bootloader boot_decrypt check_release menu_launch_type start_cockpit repo_setup gnome_initial_setup anaconda_create_user check_desktop_clean download_modularity_tests quit_firefox advisory_get_installed_packages advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut lo_dismiss_tip disable_firefox_studies select_rescue_mode copy_devcdrom_as_isofile bypass_1691487 get_release_number check_left_bar check_top_bar check_prerelease check_version spell_version_number _assert_and_click is_branched rec_log click_unwanted_notifications/;
our @EXPORT = qw/run_with_error_check type_safely type_very_safely desktop_vt boot_to_login_screen console_login console_switch_layout desktop_switch_layout console_loadkeys_us do_bootloader boot_decrypt check_release menu_launch_type start_cockpit repo_setup gnome_initial_setup anaconda_create_user check_desktop_clean download_modularity_tests quit_firefox advisory_get_installed_packages advisory_check_nonmatching_packages start_with_launcher quit_with_shortcut lo_dismiss_tip disable_firefox_studies select_rescue_mode copy_devcdrom_as_isofile bypass_1691487 get_release_number check_left_bar check_top_bar check_prerelease check_version spell_version_number _assert_and_click is_branched rec_log click_unwanted_notifications repos_mirrorlist/;
sub run_with_error_check {
my ($func, $error_screen) = @_;
@ -341,6 +341,16 @@ sub start_cockpit {
}
}
sub repos_mirrorlist {
# Use mirrorlist not metalink so we don't hit the timing issue where
# the infra repo is updated but mirrormanager metadata checksums
# have not been updated, and the infra repo is rejected as its
# metadata checksum isn't known to MM
my $files = shift;
my $files ||= "/etc/yum.repos.d/fedora*.repo";
assert_script_run "sed -i -e 's,metalink,mirrorlist,g' ${files}";
}
sub _repo_setup_compose {
# Appropriate repo setup steps for testing a compose
# disable updates-testing and updates and use the compose location
@ -370,11 +380,7 @@ sub _repo_setup_updates {
# Appropriate repo setup steps for testing a Bodhi update
# Check if we already ran, bail if so
return unless script_run "test -f /etc/yum.repos.d/advisory.repo";
# Use mirrorlist not metalink so we don't hit the timing issue where
# the infra repo is updated but mirrormanager metadata checksums
# have not been updated, and the infra repo is rejected as its
# metadata checksum isn't known to MM
assert_script_run "sed -i -e 's,metalink,mirrorlist,g' /etc/yum.repos.d/fedora*.repo";
_repos_mirrorlist();
if (get_var("DEVELOPMENT")) {
# Disable updates-testing so other bad updates don't break us
# this will do nothing on upgrade tests as we're on a stable

View File

@ -23,7 +23,7 @@ sub run {
# now add the side repo to the config
assert_script_run 'printf "[advisory]\nname=Advisory repo\nbaseurl=file:///opt/update_repo\nenabled=1\nmetadata_expire=3600\ngpgcheck=0\n\"\"\"" >> /etc/mock/openqa.cfg';
# replace metalink with mirrorlist so we don't get slow mirrors
assert_script_run "sed -i -e 's,metalink,mirrorlist,g' /etc/mock/openqa.cfg";
repos_mirrorlist("/etc/mock/openqa.cfg");
# upload the config so we can check it's OK
upload_logs "/etc/mock/openqa.cfg";
# now check out the kickstarts

View File

@ -22,7 +22,7 @@ sub run {
script_run "setterm -blank 0";
# adjust repo files to use mirrorlist not metalink (to avoid
# metalink checksum timing issue causing infra repo to be rejected)
assert_script_run "sed -i -e 's,metalink,mirrorlist,g' /etc/yum.repos.d/fedora*.repo";
repos_mirrorlist;
}