diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-11-23 17:38:31 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-11-23 08:30:34 +0100 |
commit | 95edbc382d8167b59a79a570aff664ba806de809 (patch) | |
tree | 9fbf16dd994e5c940bb5d64b64cd3b8dfc85a6fc /wintest/wintest.py | |
parent | be0f4129a165c0fbfa363f87b52ce733dba4e4bc (diff) | |
download | samba-95edbc382d8167b59a79a570aff664ba806de809.tar.gz samba-95edbc382d8167b59a79a570aff664ba806de809.tar.xz samba-95edbc382d8167b59a79a570aff664ba806de809.zip |
wintest Evolve wintest to handle it's own BIND nameserver
The changes here start our own copy of BIND, listening on a new
interface that we create at the start of the script. The user must
specify the IP address etc that this interface will have, and BIND and
Samba will bind to that interface only.
This means that we won't conflict with an existing BIND on the system,
so long as it isn't configured to listen on all interfaces.
We also auto-create the /etc/resolv.conf and restore it at the end of
the script, using the existing server value from the script as a
forwarder.
Andrew Bartlett
Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Tue Nov 23 08:30:34 CET 2010 on sn-devel-104
Diffstat (limited to 'wintest/wintest.py')
-rw-r--r-- | wintest/wintest.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/wintest/wintest.py b/wintest/wintest.py index 27312d20ab1..4c93017f3b8 100644 --- a/wintest/wintest.py +++ b/wintest/wintest.py @@ -127,6 +127,21 @@ class wintest(): else: return subprocess.call(cmd, shell=shell, cwd=dir) + def run_child(self, cmd, dir="."): + cwd = os.getcwd() + cmd = self.substitute(cmd) + if isinstance(cmd, list): + self.info('$ ' + " ".join(cmd)) + else: + self.info('$ ' + cmd) + if isinstance(cmd, list): + shell=False + else: + shell=True + os.chdir(dir) + ret = subprocess.Popen(cmd, shell=shell) + os.chdir(cwd) + return ret def cmd_output(self, cmd): '''return output from and command''' @@ -200,6 +215,13 @@ class wintest(): return ret + def get_nameserver(self): + '''Get the current nameserver from /etc/resolv.conf''' + child = self.pexpect_spawn('cat /etc/resolv.conf') + child.expect('nameserver') + child.expect('\d+.\d+.\d+.\d+') + return child.after + def vm_poweroff(self, vmname, checkfail=True): '''power off a VM''' self.setvar('VMNAME', vmname) @@ -294,7 +316,7 @@ class wintest(): child.expect("C:") def set_dns(self, child): - child.sendline('netsh interface ip set dns "${WIN_NIC}" static ${DNSSERVER} primary') + child.sendline('netsh interface ip set dns "${WIN_NIC}" static ${INTERFACE_IP} primary') i = child.expect(['C:', pexpect.EOF, pexpect.TIMEOUT], timeout=5) if i > 0: return True |