Wipe the configured database, not the default one
authorJakob Kramer <jakob.kramer@gmx.de>
Sat, 24 Mar 2012 14:33:36 +0000 (15:33 +0100)
committerJakob Kramer <jakob.kramer@gmx.de>
Sat, 24 Mar 2012 14:33:36 +0000 (15:33 +0100)
mediagoblin/gmg_commands/wipealldata.py

index 3081bbc05a6c208ffb75ab2c6cde854edb15dbdc..37217fd183206c30400b3cba3db599fe2aa300a6 100644 (file)
@@ -20,12 +20,16 @@ import sys
 import os
 import shutil
 
+from mediagoblin.init import setup_global_and_app_config
+
 
 def wipe_parser_setup(subparser):
     pass
 
 
 def wipe(args):
+    global_config, app_config = setup_global_and_app_config(args.conf_file)
+
     print "*** WARNING! ***"
     print ""
     print "Running this will destroy your mediagoblin database,"
@@ -39,12 +43,12 @@ def wipe(args):
         'Are you **SURE** you want to destroy your environment?  '
         '(if so, type "yes")> ')
 
-    if not drop_it == 'yes':
+    if drop_it != 'yes':
         return
 
     print "nixing data in mongodb...."
     conn = pymongo.Connection()
-    conn.drop_database('mediagoblin')
+    conn.drop_database(app_config["db_name"])
 
     for directory in [os.path.join(os.getcwd(), "user_dev", "media"),
                       os.path.join(os.getcwd(), "user_dev", "beaker")]: