[cleanup] started to improve cubicweb-ctl dialog messages consistency
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Mon, 27 Jul 2009 10:06:13 +0200
changeset 2512 106b2a05dc88
parent 2511 a4b50efb97f6
child 2513 497e5807db41
[cleanup] started to improve cubicweb-ctl dialog messages consistency
common/migration.py
cwctl.py
server/sqlutils.py
--- a/common/migration.py	Mon Jul 27 09:52:21 2009 +0200
+++ b/common/migration.py	Mon Jul 27 10:06:13 2009 +0200
@@ -69,7 +69,7 @@
     ability to show the script's content
     """
     while True:
-        confirm = raw_input('** execute %r (Y/n/s[how]) ?' % scriptpath)
+        confirm = raw_input('Execute %r (Y/n/s[how]) ?' % scriptpath)
         confirm = confirm.strip().lower()
         if confirm in ('n', 'no'):
             return False
@@ -172,7 +172,7 @@
 
     def interact(self, args, kwargs, meth):
         """execute the given method according to user's confirmation"""
-        msg = 'execute command: %s(%s) ?' % (
+        msg = 'Execute command: %s(%s) ?' % (
             meth.__name__[4:],
             ', '.join([repr(arg) for arg in args] +
                       ['%s=%r' % (n,v) for n,v in kwargs.items()]))
--- a/cwctl.py	Mon Jul 27 09:52:21 2009 +0200
+++ b/cwctl.py	Mon Jul 27 10:06:13 2009 +0200
@@ -614,6 +614,7 @@
         return InstanceCommand.ordered_instances(self)
 
     def upgrade_instance(self, appid):
+        print '\n' + underline_title('Upgrading the instance %s' % appid)
         from logilab.common.changelog import Version
         config = cwcfg.config_for(appid)
         config.repairing = True # notice we're not starting the server
@@ -624,11 +625,9 @@
             # not a server config
             pass
         # get instance and installed versions for the server and the componants
-        print 'getting versions configuration from the repository...'
         mih = config.migration_handler()
         repo = mih.repo_connect()
         vcconf = repo.get_versions()
-        print 'done'
         if self.config.force_componant_version:
             packversions = {}
             for vdef in self.config.force_componant_version:
@@ -654,10 +653,11 @@
         if cubicwebversion > applcubicwebversion:
             toupgrade.append(('cubicweb', applcubicwebversion, cubicwebversion))
         if not self.config.fs_only and not toupgrade:
-            print 'no software migration needed for instance %s' % appid
+            print '-> no software migration needed for instance %s.' % appid
             return
         for cube, fromversion, toversion in toupgrade:
-            print '**** %s migration %s -> %s' % (cube, fromversion, toversion)
+            print '\n' + underline_title('%s migration %s -> %s' %
+                                         (cube, fromversion, toversion))
         # only stop once we're sure we have something to do
         if not (cwcfg.mode == 'dev' or self.config.nostartstop):
             self.stop_instance(appid)
@@ -675,13 +675,13 @@
         errors = config.i18ncompile(langs)
         if errors:
             print '\n'.join(errors)
-            if not confirm('error while compiling message catalogs, '
+            if not confirm('Error while compiling message catalogs, '
                            'continue anyway ?'):
-                print 'migration not completed'
+                print '-> migration not completed.'
                 return
         mih.shutdown()
         print
-        print 'instance migrated'
+        print '-> instance migrated.'
         if not (cwcfg.mode == 'dev' or self.config.nostartstop):
             self.start_instance(appid)
         print
--- a/server/sqlutils.py	Mon Jul 27 09:52:21 2009 +0200
+++ b/server/sqlutils.py	Mon Jul 27 10:06:13 2009 +0200
@@ -123,10 +123,11 @@
 def sql_source_backup(source, sqladapter, confirm, backupfile,
                       askconfirm=False):
     if exists(backupfile):
-        if not confirm('backup file %s exists, overwrite it?' % backupfile):
+        if not confirm('Backup file %s exists, overwrite it?' % backupfile):
             return
-    elif askconfirm and not confirm('backup %s database?'
+    elif askconfirm and not confirm('Backup %s database?'
                                     % source.repo.config.appid):
+        print '-> no backup done.'
         return
     # should close opened connection before backuping
     source.close_pool_connections()
@@ -140,7 +141,7 @@
     if not exists(backupfile):
         raise Exception("backup file %s doesn't exist" % backupfile)
     app = source.repo.config.appid
-    if askconfirm and not confirm('restore %s %s database from %s ?'
+    if askconfirm and not confirm('Restore %s %s database from %s ?'
                                   % (app, source.uri, backupfile)):
         return
     # should close opened connection before restoring
@@ -201,15 +202,15 @@
         while True:
             print cmd
             if os.system(cmd):
-                print 'error while backuping the base'
-                answer = confirm('continue anyway?',
+                print '-> error while backuping the base'
+                answer = confirm('Continue anyway?',
                                  shell=False, abort=False, retry=True)
                 if not answer:
                     raise SystemExit(1)
                 if answer == 1: # 1: continue, 2: retry
                     break
             else:
-                print 'database backup:', backupfile
+                print '-> backup file',  backupfile
                 restrict_perms_to_user(backupfile, self.info)
                 break