diff --git a/tests/foreman/destructive/test_installer.py b/tests/foreman/destructive/test_installer.py index 8c61633fc53..46056ad83a5 100644 --- a/tests/foreman/destructive/test_installer.py +++ b/tests/foreman/destructive/test_installer.py @@ -28,10 +28,15 @@ def set_random_fqdn(target_sat): shortname = gen_string('alpha') new_domain = gen_domain() target_sat.execute( - f'echo "search {new_domain}" >> /etc/resolv.conf; hostnamectl set-hostname {shortname}' + 'mv -f /etc/resolv.conf /etc/resolv.conf.bak; ' + f'echo "search {new_domain}" > /etc/resolv.conf; ' + f'hostnamectl set-hostname {shortname}' ) yield shortname, new_domain - target_sat.execute(f'hostnamectl set-hostname {target_sat.hostname}') + target_sat.execute( + 'mv -f /etc/resolv.conf.bak /etc/resolv.conf; ' + f'hostnamectl set-hostname {target_sat.hostname}' + ) def test_installer_sat_pub_directory_accessibility(target_sat):