Browse Source

Improve message before converting the database

oz123 11 years ago
parent
commit
cfab43a811
2 changed files with 14 additions and 14 deletions
  1. 2 8
      pwman/tests/test_complete_ui.py
  2. 12 6
      scripts/pwman3

+ 2 - 8
pwman/tests/test_complete_ui.py

@@ -26,13 +26,7 @@ import shutil
 OLD_DB_PATH = os.path.join(os.path.dirname(__file__), 'pwman.v0.0.8.db')
 NEW_DB_PATH = os.path.join(os.path.dirname(__file__), 'pwman.v0.0.8-newdb.db')
 
-_db_warn = ("\n*** WARNNING: You are using the old database format"
-            " which is insecure."
-            " Please upgrade to the new database "
-            " format."
-            " You can upgrade the database now, or you can do it later."
-            " Check the help (pwman3 -h) or look at the manpage. "
-            "***")
+_db_warn = ("pwman3 detected that are using the old database format")
 
 
 class Ferrum(unittest.TestCase):
@@ -42,7 +36,7 @@ class Ferrum(unittest.TestCase):
         child = pexpect.spawn(os.path.join(os.path.dirname(__file__),
                                            '../../scripts/pwman3') +
                               ' -t -d '+OLD_DB_PATH)
-        self.assertEqual(0, child.expect_exact(_db_warn, timeout=0.5))
+        self.assertEqual(0, child.expect(_db_warn, timeout=0.5))
 
     def test_run_convert(self):
         "invoke pwman with -k option to convert the old data"

+ 12 - 6
scripts/pwman3

@@ -28,13 +28,14 @@ import shutil
 
 _saveconfig = True
 
-_db_warn = ("\n*** WARNNING: You are using the old database format"
+_db_warn = ("pwman3 detected that are using the old database format"
             " which is insecure."
-            " Please upgrade to the new database "
-            " format."
-            " You can upgrade the database now, or you can do it later."
-            " Check the help (pwman3 -h) or look at the manpage. "
-            "***")
+            " pwman3 will try to convert the database now."
+            "\n"
+            "If you choose not to convert the database, pwman3, will quit."
+            "\nYou can check the help (pwman3 -h) or look at the manpage how to convert "
+            " the database manually."
+            )
 
 
 def parser_options():
@@ -199,6 +200,11 @@ def main(args):
         sys.exit(0)
 
     if dbver < 0.4:
+        ans = raw_input("Would you like to proceed with conversion of the database"
+                        " before starting pwman3 [y/N]?")
+        if ans.lower() != "y":
+            sys.exit(1)
+
         auto_convert()
         dbver = 0.4