On 10/01/2015 10:06 AM, Milan Kubík wrote:
Fixes https://fedorahosted.org/freeipa/ticket/5331
Patch attached.
Patch for ipa-4-2 branch.
Milan
From 5d19b29474b577688910a60fbc5efdf38ff6c455 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Milan=20Kub=C3=ADk?= <mku...@redhat.com>
Date: Fri, 25 Sep 2015 21:09:24 +0200
Subject: [PATCH] ipatests: configure Network Manager not to manage resolv.conf
For the duration of the test, makes resolv.conf unmanaged.
https://fedorahosted.org/freeipa/ticket/5331
---
ipaplatform/base/paths.py | 2 +-
ipatests/test_integration/tasks.py | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/ipaplatform/base/paths.py b/ipaplatform/base/paths.py
index 215caf90ea1ca4e5db8f43f8f09002ce5d5cd280..a272143d0053451c017c0df613951cc0e6d52c54 100644
--- a/ipaplatform/base/paths.py
+++ b/ipaplatform/base/paths.py
@@ -354,6 +354,6 @@ class BasePathNamespace(object):
DB2BAK = '/usr/sbin/db2bak'
KDCPROXY_CONFIG = '/etc/ipa/kdcproxy/kdcproxy.conf'
CERTMONGER = '/usr/sbin/certmonger'
-
+ NETWORK_MANAGER_CONFIG_DIR = '/etc/NetworkManager/conf.d'
path_namespace = BasePathNamespace
diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index f579f286826f749a8c5f8433f2a8bf7348664ba9..d188adbd4d7b3af7dd82b964917770c5afda7a96 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -40,6 +40,7 @@ from ipatests.test_integration.host import Host
log = log_mgr.get_logger(__name__)
+IPATEST_NM_CONFIG = '20-ipatest-unmanaged-resolv.conf'
def prepare_host(host):
if isinstance(host, Host):
@@ -56,6 +57,7 @@ def prepare_host(host):
def apply_common_fixes(host):
fix_etc_hosts(host)
fix_hostname(host)
+ modify_nm_resolv_conf_settings(host)
fix_resolv_conf(host)
@@ -101,6 +103,20 @@ def fix_hostname(host):
host.run_command('hostname > %s' % ipautil.shell_quote(backupname))
+def modify_nm_resolv_conf_settings(host):
+ config = "[main]\ndns=none\n"
+ path = os.path.join(paths.NETWORK_MANAGER_CONFIG_DIR, IPATEST_NM_CONFIG)
+
+ host.put_file_contents(path, config)
+ host.run_command(['systemctl', 'restart', 'NetworkManager'], raiseonerr=False)
+
+
+def undo_nm_resolv_conf_settings(host):
+ path = os.path.join(paths.NETWORK_MANAGER_CONFIG_DIR, IPATEST_NM_CONFIG)
+ host.run_command(['rm', '-f', path], raiseonerr=False)
+ host.run_command(['systemctl', 'restart', 'NetworkManager'], raiseonerr=False)
+
+
def fix_resolv_conf(host):
backup_file(host, paths.RESOLV_CONF)
lines = host.get_file_contents(paths.RESOLV_CONF).splitlines()
@@ -128,6 +144,7 @@ def fix_apache_semaphores(master):
def unapply_fixes(host):
restore_files(host)
restore_hostname(host)
+ undo_nm_resolv_conf_settings(host)
# Clean up the test directory
host.run_command(['rm', '-rvf', host.config.test_dir])
--
2.6.0
--
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code