390 }), |
390 }), |
391 ) |
391 ) |
392 |
392 |
393 def start_instance(self, appid): |
393 def start_instance(self, appid): |
394 """start the instance's server""" |
394 """start the instance's server""" |
395 # use get() since start may be used from other commands (eg upgrade) |
395 debug = self['debug'] |
396 # without all options defined |
396 force = self['force'] |
397 debug = self.get('debug') |
397 loglevel = self['loglevel'] |
398 force = self.get('force') |
|
399 loglevel = self.get('loglevel') |
|
400 config = cwcfg.config_for(appid) |
398 config = cwcfg.config_for(appid) |
401 if loglevel is not None: |
399 if loglevel is not None: |
402 loglevel = 'LOG_%s' % loglevel.upper() |
400 loglevel = 'LOG_%s' % loglevel.upper() |
403 config.global_set_option('log-threshold', loglevel) |
401 config.global_set_option('log-threshold', loglevel) |
404 config.init_log(loglevel, debug=debug, force=True) |
402 config.init_log(loglevel, debug=debug, force=True) |
405 if self.get('profile'): |
403 if self['profile']: |
406 config.global_set_option('profile', self.config.profile) |
404 config.global_set_option('profile', self.config.profile) |
407 helper = self.config_helper(config, cmdname='start') |
405 helper = self.config_helper(config, cmdname='start') |
408 pidf = config['pid-file'] |
406 pidf = config['pid-file'] |
409 if exists(pidf) and not force: |
407 if exists(pidf) and not force: |
410 msg = "%s seems to be running. Remove %s by hand if necessary or use \ |
408 msg = "%s seems to be running. Remove %s by hand if necessary or use \ |
483 super(RestartInstanceCommand, self).run_args(args, askconfirm) |
481 super(RestartInstanceCommand, self).run_args(args, askconfirm) |
484 return |
482 return |
485 print ('some specific start order is specified, will first stop all ' |
483 print ('some specific start order is specified, will first stop all ' |
486 'instances then restart them.') |
484 'instances then restart them.') |
487 # get instances in startorder |
485 # get instances in startorder |
488 stopped = [] |
|
489 for appid in args: |
486 for appid in args: |
490 if askconfirm: |
487 if askconfirm: |
491 print '*'*72 |
488 print '*'*72 |
492 if not ASK.confirm('%s instance %r ?' % (self.name, appid)): |
489 if not ASK.confirm('%s instance %r ?' % (self.name, appid)): |
493 continue |
490 continue |
606 repository should connect to for upgrading. When unspecified or 'migration' is \ |
603 repository should connect to for upgrading. When unspecified or 'migration' is \ |
607 given, appropriate sources for migration will be automatically selected \ |
604 given, appropriate sources for migration will be automatically selected \ |
608 (recommended). If 'all' is given, will connect to all defined sources.", |
605 (recommended). If 'all' is given, will connect to all defined sources.", |
609 }), |
606 }), |
610 ) |
607 ) |
611 |
|
612 def ordered_instances(self): |
|
613 # need this since mro return StopInstanceCommand implementation |
|
614 return InstanceCommand.ordered_instances(self) |
|
615 |
608 |
616 def upgrade_instance(self, appid): |
609 def upgrade_instance(self, appid): |
617 print '\n' + underline_title('Upgrading the instance %s' % appid) |
610 print '\n' + underline_title('Upgrading the instance %s' % appid) |
618 from logilab.common.changelog import Version |
611 from logilab.common.changelog import Version |
619 config = cwcfg.config_for(appid) |
612 config = cwcfg.config_for(appid) |