cwctl.py
branchstable
changeset 3638 648d6dbec630
parent 3619 af81a4f7053e
child 3674 387d51af966d
child 3700 fd550e4dc515
equal deleted inserted replaced
3637:0a0e86cb5c89 3638:648d6dbec630
    16 
    16 
    17 from logilab.common.clcommands import register_commands, pop_arg
    17 from logilab.common.clcommands import register_commands, pop_arg
    18 from logilab.common.shellutils import ASK
    18 from logilab.common.shellutils import ASK
    19 
    19 
    20 from cubicweb import ConfigurationError, ExecutionError, BadCommandUsage, underline_title
    20 from cubicweb import ConfigurationError, ExecutionError, BadCommandUsage, underline_title
    21 from cubicweb.cwconfig import CubicWebConfiguration as cwcfg, CONFIGURATIONS
    21 from cubicweb.cwconfig import CubicWebConfiguration as cwcfg, CWDEV, CONFIGURATIONS
    22 from cubicweb.toolsutils import Command, main_run,  rm, create_dir
    22 from cubicweb.toolsutils import Command, main_run,  rm, create_dir
    23 
    23 
    24 def wait_process_end(pid, maxtry=10, waittime=1):
    24 def wait_process_end(pid, maxtry=10, waittime=1):
    25     """wait for a process to actually die"""
    25     """wait for a process to actually die"""
    26     import signal
    26     import signal
   654             print '-> no software migration needed for instance %s.' % appid
   654             print '-> no software migration needed for instance %s.' % appid
   655             return
   655             return
   656         for cube, fromversion, toversion in toupgrade:
   656         for cube, fromversion, toversion in toupgrade:
   657             print '-> migration needed from %s to %s for %s' % (fromversion, toversion, cube)
   657             print '-> migration needed from %s to %s for %s' % (fromversion, toversion, cube)
   658         # only stop once we're sure we have something to do
   658         # only stop once we're sure we have something to do
   659         if not (cwcfg.mode == 'dev' or self.config.nostartstop):
   659         if not (CWDEV or self.config.nostartstop):
   660             StopInstanceCommand().stop_instance(appid)
   660             StopInstanceCommand().stop_instance(appid)
   661         # run cubicweb/componants migration scripts
   661         # run cubicweb/componants migration scripts
   662         mih.migrate(vcconf, reversed(toupgrade), self.config)
   662         mih.migrate(vcconf, reversed(toupgrade), self.config)
   663         # rewrite main configuration file
   663         # rewrite main configuration file
   664         mih.rewrite_configuration()
   664         mih.rewrite_configuration()
   677                 print '-> migration not completed.'
   677                 print '-> migration not completed.'
   678                 return
   678                 return
   679         mih.shutdown()
   679         mih.shutdown()
   680         print
   680         print
   681         print '-> instance migrated.'
   681         print '-> instance migrated.'
   682         if not (cwcfg.mode == 'dev' or self.config.nostartstop):
   682         if not (CWDEV or self.config.nostartstop):
   683             StartInstanceCommand().start_instance(appid)
   683             StartInstanceCommand().start_instance(appid)
   684         print
   684         print
   685 
   685 
   686 
   686 
   687 class ShellCommand(Command):
   687 class ShellCommand(Command):