mirror of
https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git
synced 2024-11-28 00:23:09 +00:00
Share DNS/DHCP server setup between nfs and pxe servers
They both need to be DNS/DHCP servers, I think, so split the code into a shared function. Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
parent
f65b81d796
commit
c645d0da88
22
lib/utils.pm
22
lib/utils.pm
@ -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 repo_setup setup_workaround_repo cleanup_workaround_repo console_initial_setup gnome_initial_setup anaconda_create_user check_desktop 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 register_application get_registered_applications solidify_wallpaper/;
|
||||
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 repo_setup setup_workaround_repo cleanup_workaround_repo console_initial_setup gnome_initial_setup anaconda_create_user check_desktop 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 register_application get_registered_applications solidify_wallpaper setup_dhcp_server/;
|
||||
|
||||
# We introduce this global variable to hold the list of applications that have
|
||||
# registered during the apps_startstop_test when they have sucessfully run.
|
||||
@ -1387,4 +1387,24 @@ sub solidify_wallpaper {
|
||||
}
|
||||
}
|
||||
|
||||
# Shared by some of the support tests that need to act as DHCP/DNS
|
||||
sub setup_dhcp_server {
|
||||
# disable systemd-resolved, it conflicts with dnsmasq
|
||||
unless (script_run "systemctl is-active systemd-resolved.service") {
|
||||
script_run "systemctl stop systemd-resolved.service";
|
||||
script_run "systemctl disable systemd-resolved.service";
|
||||
script_run "rm -f /etc/resolv.conf";
|
||||
script_run "systemctl restart NetworkManager";
|
||||
}
|
||||
## DNS / DHCP (dnsmasq)
|
||||
# create config
|
||||
assert_script_run "printf 'domain=domain.local\ndhcp-range=172.16.2.150,172.16.2.199\ndhcp-option=option:router,172.16.2.2\n' > /etc/dnsmasq.conf";
|
||||
# open firewall ports
|
||||
assert_script_run "firewall-cmd --add-service=dhcp";
|
||||
assert_script_run "firewall-cmd --add-service=dns";
|
||||
# start server
|
||||
assert_script_run "systemctl restart dnsmasq.service";
|
||||
assert_script_run "systemctl is-active dnsmasq.service";
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -6,27 +6,9 @@ use mmapi;
|
||||
use utils;
|
||||
|
||||
sub run {
|
||||
my $self=shift;
|
||||
# disable systemd-resolved, it conflicts with dnsmasq
|
||||
unless (script_run "systemctl is-active systemd-resolved.service") {
|
||||
script_run "systemctl stop systemd-resolved.service";
|
||||
script_run "systemctl disable systemd-resolved.service";
|
||||
script_run "rm -f /etc/resolv.conf";
|
||||
script_run "systemctl restart NetworkManager";
|
||||
}
|
||||
## DNS / DHCP (dnsmasq)
|
||||
# create config
|
||||
assert_script_run "printf 'domain=domain.local\ndhcp-range=172.16.2.150,172.16.2.199\ndhcp-option=option:router,172.16.2.2\n' > /etc/dnsmasq.conf";
|
||||
# open firewall ports
|
||||
assert_script_run "firewall-cmd --add-service=dhcp";
|
||||
assert_script_run "firewall-cmd --add-service=dns";
|
||||
# start server
|
||||
assert_script_run "systemctl restart dnsmasq.service";
|
||||
assert_script_run "systemctl is-active dnsmasq.service";
|
||||
|
||||
|
||||
## NFS
|
||||
|
||||
my $self = shift;
|
||||
# set up as a DHCP/DNS server
|
||||
setup_dhcp_server;
|
||||
# create the file share
|
||||
assert_script_run "mkdir -p /export";
|
||||
# get the kickstart
|
||||
|
@ -7,7 +7,9 @@ use utils;
|
||||
|
||||
sub run {
|
||||
my $self = shift;
|
||||
# set up PXE server (via dnsmasq)
|
||||
# set up as a DHCP/DNS server
|
||||
setup_dhcp_server;
|
||||
# set up as a PXE server (via dnsmasq)
|
||||
# don't get hung up on slow mirrors when DNFing...
|
||||
repos_mirrorlist;
|
||||
# create necessary dirs
|
||||
|
Loading…
Reference in New Issue
Block a user