automatically install accounts if we created the db twisty
authorMark Hammond <mhammond@skippinet.com.au>
Mon, 30 Mar 2009 11:32:26 +1100
branchtwisty
changeset 140 5ef43d01c4fec2325a44db4c56cda04a2c44a7f8
parent 139 bdcda2baf4b8535ca600c9b082901f399d51e966
child 141 9aa5903c2e4eb77802b9f2a3b72679f04e5dcdc6
push id1
push userroot
push dateWed, 08 Apr 2009 01:46:05 +0000
automatically install accounts if we created the db
server/python/run-raindrop.py
--- a/server/python/run-raindrop.py
+++ b/server/python/run-raindrop.py
@@ -180,18 +180,23 @@ def main():
     # create an initial deferred to perform tasks which must occur before we
     # can start.  The final callback added will fire up the real servers.
     asynch_tasks = []
     d = defer.Deferred()
     def mutter(whateva):
         print "Raindrops keep falling on my head..."
     d.addCallback(mutter)
 
-    # Check DB exists.
-    d.addCallback(model.fab_db)
+    # Check DB exists and if not, install accounts.
+    def maybe_install_accounts(db_created):
+        if db_created:
+            return bootstrap.install_accounts(None)
+    d.addCallback(model.fab_db
+        ).addCallback(maybe_install_accounts
+        )
     # Check if the files on the filesystem need updating.
     d.addCallback(bootstrap.install_client_files, options)
     d.addCallback(bootstrap.install_views, options)
 
     # Now process the args specified.
     for arg in args:
         try:
             func = all_args[arg]