Hi Milan,

On 02/12/2016 04:03 PM, Milan Kubík wrote:
> On 02/04/2016 08:49 AM, Oleg Fayans wrote:
>> Hi Petr,
>>
>> On 02/03/2016 02:19 PM, Petr Spacek wrote:
>>> On 3.2.2016 10:22, Oleg Fayans wrote:
>>>> Guys, can anyone take a look at this?
>>> The commit message does not explain why you are setting search path.
>> Fixed.
>>
>>> I have to say that I do not like touching resolv.conf, as stated many times
>>> earlier. Why the test has to reconfigure the host and cannot use values
>>> provided by the provisioning system?
>> This patch exactly removes this messing around with nameservers in
>> resolv.conf
>> It introduces the possibility to put ipa domain in the search directive
>> of resolv.conf so that we could test service autodiscovery during client
>> installation.
>>
>>
>>
> I just verified that the tampering with resolv.conf is not needed
> (libvirt and ovirt/rhev). I think this is an artifact from the whole
> issue of "let's use improvised domain names, what can go wrong" approach
> that was uncovered by the enforced DNS checks. I think we can defer the
> networking configuration to provisioning system.

Agreed. The latest patch gets rid of all resolv.conf related
manipulations. The tests work (where not affected by
https://fedorahosted.org/bind-dyndb-ldap/ticket/160)


> 
> -- 
> Milan Kubik
> 

-- 
Oleg Fayans
Quality Engineer
FreeIPA team
RedHat.
From 073e898731685fddef1768b3aeff6f68b801a48c Mon Sep 17 00:00:00 2001
From: Oleg Fayans <ofay...@ofayans.usersys.redhat.com>
Date: Fri, 19 Feb 2016 13:46:10 +0100
Subject: [PATCH] Removed messing around with resolv.conf

---
 ipatests/test_integration/tasks.py | 44 ++------------------------------------
 1 file changed, 2 insertions(+), 42 deletions(-)

diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index d37b616bd6efe437a1a979cc7a9ad8c7ea803773..e859cfc8501eec32fb2233960dd8d7fa64be76d1 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -44,8 +44,6 @@ from ipalib.constants import DOMAIN_LEVEL_0
 
 log = log_mgr.get_logger(__name__)
 
-IPATEST_NM_CONFIG = '20-ipatest-unmanaged-resolv.conf'
-
 
 def check_arguments_are(slice, instanceof):
     """
@@ -91,12 +89,9 @@ def allow_sync_ptr(host):
                      raiseonerr=False)
 
 
-def apply_common_fixes(host, fix_resolv=True):
+def apply_common_fixes(host):
     fix_etc_hosts(host)
     fix_hostname(host)
-    modify_nm_resolv_conf_settings(host)
-    if fix_resolv:
-        fix_resolv_conf(host)
     prepare_host(host)
 
 
@@ -154,40 +149,6 @@ def host_service_active(host, service):
         return False
 
 
-def modify_nm_resolv_conf_settings(host):
-    if not host_service_active(host, 'NetworkManager'):
-        return
-
-    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):
-    if not host_service_active(host, 'NetworkManager'):
-        return
-
-    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()
-    lines = ['#' + l if l.startswith('nameserver') else l for l in lines]
-    for other_host in host.domain.hosts:
-        if other_host.role in ('master', 'replica'):
-            lines.append('nameserver %s' % other_host.ip)
-    contents = '\n'.join(lines)
-    log.debug('Writing the following to /etc/resolv.conf:\n%s', contents)
-    host.put_file_contents(paths.RESOLV_CONF, contents)
-
-
 def fix_apache_semaphores(master):
     systemd_available = master.transport.file_exists(paths.SYSTEMCTL)
 
@@ -204,7 +165,6 @@ 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])
@@ -269,7 +229,7 @@ def install_master(host, setup_dns=True, setup_kra=False):
     host.collect_log(paths.SLAPD_INSTANCE_ERROR_LOG_TEMPLATE % inst)
     host.collect_log(paths.SLAPD_INSTANCE_ACCESS_LOG_TEMPLATE % inst)
 
-    apply_common_fixes(host, fix_resolv=False)
+    apply_common_fixes(host)
     fix_apache_semaphores(host)
 
     args = [
-- 
1.8.3.1

-- 
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

Reply via email to