diff --git a/ipatests/pytest_ipa/integration/tasks.py b/ipatests/pytest_ipa/integration/tasks.py index 865f6dc80..7c0cb20d9 100755 --- a/ipatests/pytest_ipa/integration/tasks.py +++ b/ipatests/pytest_ipa/integration/tasks.py @@ -65,6 +65,7 @@ from ipatests.create_external_ca import ExternalCA from .env_config import env_to_script from .host import Host from .firewall import Firewall +from .resolver import ResolvedResolver logger = logging.getLogger(__name__) @@ -143,10 +144,26 @@ def rpcbind_kadmin_workaround(host): break +def disable_systemd_resolved_cache(host): + if not ResolvedResolver.is_our_resolver(host): + return + resolved_conf_file = ( + '/etc/systemd/resolved.conf.d/zzzz-ipatests-disable-cache.conf') + resolved_conf = textwrap.dedent(''' + # generated by IPA tests + [Resolve] + Cache=no + ''') + host.run_command(['mkdir', '-p', os.path.dirname(resolved_conf_file)]) + host.put_file_contents(resolved_conf_file, resolved_conf) + host.run_command(['systemctl', 'restart', 'systemd-resolved']) + + def apply_common_fixes(host): prepare_host(host) fix_hostname(host) rpcbind_kadmin_workaround(host) + disable_systemd_resolved_cache(host) def prepare_dse_changes(host, log_level=8192):