wintest: add option to select the dns backend
authorBjörn Baumbach <bb@sernet.de>
Thu, 31 May 2012 12:15:47 +0000 (14:15 +0200)
committerKai Blin <kai@samba.org>
Thu, 21 Jun 2012 19:55:20 +0000 (21:55 +0200)
This is an option to use the internal dns.

Signed-off-by: Kai Blin <kai@samba.org>
wintest/test-s4-howto.py
wintest/wintest.py

index 01aac37115425c2268c825ceeef1d1152e249518..646fa5b5c96b4f0b76ad5cc479510c9a297cafa5 100755 (executable)
@@ -36,7 +36,9 @@ def provision_s4(t, func_level="2008"):
                '--host-ip=${INTERFACE_IP}',
                '--option=bind interfaces only=yes',
                '--option=rndc command=${RNDC} -c${PREFIX}/etc/rndc.conf',
-               '${USE_NTVFS}']
+               '${USE_NTVFS}',
+               '--dns-backend=${NAMESERVER_BACKEND}',
+               '${ALLOW_DNS_UPDATES}']
     if t.getvar('INTERFACE_IPV6'):
         provision.append('--host-ip6=${INTERFACE_IPV6}')
     t.run_cmd(provision)
@@ -113,7 +115,8 @@ def test_dyndns(t):
     '''test that dynamic DNS is working'''
     t.chdir('${PREFIX}')
     t.run_cmd("sbin/samba_dnsupdate --fail-immediately")
-    t.rndc_cmd("flush")
+    if not t.getvar('NAMESERVER_BACKEND') == 'SAMBA_INTERNAL':
+        t.rndc_cmd("flush")
 
 
 def run_winjoin(t, vm):
@@ -393,7 +396,8 @@ def prep_join_as_dc(t, vm):
     t.info("Starting VMs for joining ${WIN_VM} as a second DC using samba-tool domain join DC")
     t.chdir('${PREFIX}')
     t.run_cmd('killall -9 -q samba smbd nmbd winbindd', checkfail=False)
-    t.rndc_cmd('flush')
+    if not t.getvar('NAMESERVER_BACKEND') == 'SAMBA_INTERNAL':
+        t.rndc_cmd('flush')
     t.run_cmd("rm -rf etc/smb.conf private")
     child = t.open_telnet("${WIN_HOSTNAME}", "${WIN_DOMAIN}\\administrator", "${WIN_PASS}", set_time=True)
     t.get_ipconfig(child)
@@ -559,10 +563,12 @@ def test_howto(t):
     # we don't need fsync safety in these tests
     t.putenv('TDB_NO_FSYNC', '1')
 
-    if not t.skip("configure_bind"):
-        t.configure_bind(kerberos_support=True, include='${PREFIX}/private/named.conf')
-    if not t.skip("stop_bind"):
-        t.stop_bind()
+    if not t.getvar('NAMESERVER_BACKEND') == 'SAMBA_INTERNAL':
+        if not t.skip("configure_bind"):
+            t.configure_bind(kerberos_support=True, include='${PREFIX}/private/named.conf')
+        if not t.skip("stop_bind"):
+            t.stop_bind()
+
     if not t.skip("stop_vms"):
         t.stop_vms()
 
@@ -583,10 +589,13 @@ def test_howto(t):
         test_smbclient(t)
 
     t.set_nameserver(t.getvar('INTERFACE_IP'))
-    if not t.skip("configure_bind2"):
-        t.configure_bind(kerberos_support=True, include='${PREFIX}/private/named.conf')
-    if not t.skip("start_bind"):
-        t.start_bind()
+
+    if not t.getvar('NAMESERVER_BACKEND') == 'SAMBA_INTERNAL':
+        if not t.skip("configure_bind2"):
+            t.configure_bind(kerberos_support=True, include='${PREFIX}/private/named.conf')
+        if not t.skip("start_bind"):
+            t.start_bind()
+
     if not t.skip("dns"):
         test_dns(t)
     if not t.skip("kerberos"):
index f6993b2bd68fe466f1893087dbfc41da0a16b6a4..97ff2be9eab9daf7c2cd6faf1f7dfa8159abcd8c 100644 (file)
@@ -900,6 +900,13 @@ RebootOnCompletion=No
         self.parser.add_option("--sourcetree", type='string', default=None, help='override sourcetree location')
         self.parser.add_option("--nocleanup", action='store_true', default=False, help='disable cleanup code')
         self.parser.add_option("--use-ntvfs", action='store_true', default=False, help='use NTVFS for the fileserver')
+        self.parser.add_option("--dns-backend", type="choice",
+            choices=["SAMBA_INTERNAL", "BIND9_FLATFILE", "BIND9_DLZ", "NONE"],
+            help="The DNS server backend. SAMBA_INTERNAL is the builtin name server, " \
+                 "BIND9_FLATFILE uses bind9 text database to store zone information, " \
+                 "BIND9_DLZ uses samba4 AD to store zone information (default), " \
+                 "NONE skips the DNS setup entirely (not recommended)",
+            default="BIND9_DLZ")
 
         self.opts, self.args = self.parser.parse_args()
 
@@ -938,3 +945,10 @@ RebootOnCompletion=No
             self.setvar('USE_NTVFS', "--use-ntvfs")
         else:
             self.setvar('USE_NTVFS', "")
+
+        self.setvar('NAMESERVER_BACKEND', self.opts.dns_backend)
+
+        if self.opts.dns_backend == 'SAMBA_INTERNAL':
+            self.setvar('ALLOW_DNS_UPDATES', '--option=allow dns updates = True')
+        else:
+            self.setvar('ALLOW_DNS_UPDATES', '')