wintest Set WIN_LCREALM and WIN_BASEDN automatically
authorAndrew Bartlett <abartlet@samba.org>
Tue, 30 Nov 2010 00:58:05 +0000 (11:58 +1100)
committerAndrew Tridgell <tridge@samba.org>
Wed, 1 Dec 2010 05:09:58 +0000 (16:09 +1100)
Also this uppper cases WIN_REALM, to avoid this being sensitive based
on the configuration file.

Andrew Bartlett

wintest/wintest.py

index dce2ac8..910297e 100644 (file)
@@ -26,13 +26,19 @@ class wintest():
 
     def setwinvars(self, vm, prefix='WIN'):
         '''setup WIN_XX vars based on a vm name'''
-        for v in ['VM', 'HOSTNAME', 'USER', 'PASS', 'SNAPSHOT', 'BASEDN', 'REALM', 'DOMAIN', 'IP']:
+        for v in ['VM', 'HOSTNAME', 'USER', 'PASS', 'SNAPSHOT', 'REALM', 'DOMAIN', 'IP']:
             vname = '%s_%s' % (vm, v)
             if vname in self.vars:
                 self.setvar("%s_%s" % (prefix,v), self.substitute("${%s}" % vname))
             else:
                 self.vars.pop("%s_%s" % (prefix,v), None)
 
+        if self.getvar("WIN_REALM"):
+            self.setvar("WIN_REALM", self.getvar("WIN_REALM").upper())
+            self.setvar("WIN_LCREALM", self.getvar("WIN_REALM").lower())
+            dnsdomain = self.getvar("WIN_REALM")
+            self.setvar("WIN_BASEDN", "DC=" + dnsdomain.replace(".", ",DC="))
+
     def info(self, msg):
         '''print some information'''
         if not self.list_mode: