'samba-tool gpo': Properly close transaction.
[samba.git] / source4 / scripting / python / samba / netcmd / gpo.py
index bd3480e053a73bc8f37277b491d6c43f7ce77d2d..94c70c6af3b491aa1ddd598e8af18f51d43d3c92 100644 (file)
@@ -916,11 +916,11 @@ class cmd_create(Command):
 
             # Set ACL
             conn.set_acl(sharepath, fs_sd)
-
-            self.samdb.transaction_commit()
-        except Exception, e:
+        except:
             self.samdb.transaction_cancel()
-            raise RuntimeError("Error adding GPO to AD", e)
+            raise
+        else:
+            self.samdb.transaction_commit()
 
         self.outf.write("GPO '%s' created as %s\n" % (displayname, gpo))