svn commit: samba r10193 - in branches/SAMBA_4_0: .
source/scripting/libjs
tridge at samba.org
tridge at samba.org
Tue Sep 13 01:02:07 GMT 2005
Author: tridge
Date: 2005-09-13 01:02:06 +0000 (Tue, 13 Sep 2005)
New Revision: 10193
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10193
Log:
r11632 at blu: tridge | 2005-08-30 23:08:27 +1000
if we fail to erase a ldb during provision by traversing
and deleting records (an in-place erase) then just unlink it
and start it again. This makes provisioning much more robust
to changes in ldb that make it not backward compatible with
old DBs.
Modified:
branches/SAMBA_4_0/
branches/SAMBA_4_0/source/scripting/libjs/provision.js
Changeset:
Property changes on: branches/SAMBA_4_0
___________________________________________________________________
Name: svk:merge
- 3a72dc49-98ff-0310-ab52-9b7ed7945d91:/local/samba4:9495
a953eb74-4aff-0310-a63c-855d20285ebb:/local/samba4:11631
+ 3a72dc49-98ff-0310-ab52-9b7ed7945d91:/local/samba4:9495
a953eb74-4aff-0310-a63c-855d20285ebb:/local/samba4:11632
Modified: branches/SAMBA_4_0/source/scripting/libjs/provision.js
===================================================================
--- branches/SAMBA_4_0/source/scripting/libjs/provision.js 2005-09-13 01:01:55 UTC (rev 10192)
+++ branches/SAMBA_4_0/source/scripting/libjs/provision.js 2005-09-13 01:02:06 UTC (rev 10193)
@@ -122,6 +122,18 @@
}
+/* the ldb is in bad shape, possibly due to being built from an
+ incompatible previous version of the code, so delete it
+ completely */
+function ldb_delete(ldb)
+{
+ println("Deleting " + ldb.filename);
+ sys.unlink(ldb.filename);
+ ldb.close();
+ var ok = ldb.connect(ldb.filename);
+ assert(ok);
+}
+
/*
erase an ldb, removing all records
*/
@@ -138,10 +150,18 @@
/* and the rest */
var res = ldb.search("(|(objectclass=*)(dn=*))", attrs);
var i;
+ if (typeof(res) == "undefined") {
+ ldb_delete(ldb);
+ return;
+ }
for (i=0;i<res.length;i++) {
ldb.del(res[i].dn);
}
res = ldb.search("(objectclass=*)", attrs);
+ if (res.length != 0) {
+ ldb_delete(ldb);
+ return;
+ }
assert(res.length == 0);
}
@@ -170,6 +190,8 @@
data = data + extra;
data = substitute_var(data, subobj);
+ ldb.filename = dbname;
+
var ok = ldb.connect(dbname);
assert(ok);
More information about the samba-cvs
mailing list