s3-provision: cope with the policy directory already existing
authorAndrew Tridgell <tridge@samba.org>
Tue, 3 Aug 2010 07:15:10 +0000 (17:15 +1000)
committerAndrew Tridgell <tridge@samba.org>
Mon, 16 Aug 2010 22:44:28 +0000 (08:44 +1000)
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
source4/scripting/python/samba/provision.py

index 8be3f655d247af7b86803ab427efd7c2115551f4..9014e49b1c60cb254dfebbd8e00bb1ca23c00cf4 100644 (file)
@@ -949,11 +949,16 @@ def getpolicypath(sysvolpath, dnsdomain, guid):
     return policy_path
 
 def create_gpo_struct(policy_path):
-    os.makedirs(policy_path, 0755)
+    if not os.path.exists(policy_path):
+        os.makedirs(policy_path, 0755)
     open(os.path.join(policy_path, "GPT.INI"), 'w').write(
                       "[General]\r\nVersion=65543")
-    os.makedirs(os.path.join(policy_path, "MACHINE"), 0755)
-    os.makedirs(os.path.join(policy_path, "USER"), 0755)
+    p = os.path.join(policy_path, "MACHINE")
+    if not os.path.exists(p):
+        os.makedirs(p, 0755)
+    p = os.path.join(policy_path, "USER")
+    if not os.path.exists(p):
+        os.makedirs(p, 0755)
 
 
 def setup_gpo(sysvolpath, dnsdomain, policyguid, policyguid_dc):