equal
deleted
inserted
replaced
749 |
749 |
750 def upgrade_instance(self, appid): |
750 def upgrade_instance(self, appid): |
751 print '\n' + underline_title('Upgrading the instance %s' % appid) |
751 print '\n' + underline_title('Upgrading the instance %s' % appid) |
752 from logilab.common.changelog import Version |
752 from logilab.common.changelog import Version |
753 config = cwcfg.config_for(appid) |
753 config = cwcfg.config_for(appid) |
|
754 instance_running = exists(config['pid-file']) |
754 config.repairing = True # notice we're not starting the server |
755 config.repairing = True # notice we're not starting the server |
755 config.verbosity = self.config.verbosity |
756 config.verbosity = self.config.verbosity |
756 set_sources_mode = getattr(config, 'set_sources_mode', None) |
757 set_sources_mode = getattr(config, 'set_sources_mode', None) |
757 if set_sources_mode is not None: |
758 if set_sources_mode is not None: |
758 set_sources_mode(self.config.ext_sources or ('migration',)) |
759 set_sources_mode(self.config.ext_sources or ('migration',)) |
780 else: |
781 else: |
781 applcubicwebversion = vcconf.get('cubicweb') |
782 applcubicwebversion = vcconf.get('cubicweb') |
782 if cubicwebversion > applcubicwebversion: |
783 if cubicwebversion > applcubicwebversion: |
783 toupgrade.append(('cubicweb', applcubicwebversion, cubicwebversion)) |
784 toupgrade.append(('cubicweb', applcubicwebversion, cubicwebversion)) |
784 # only stop once we're sure we have something to do |
785 # only stop once we're sure we have something to do |
785 if not (CWDEV or self.config.nostartstop): |
786 if instance_running and not (CWDEV or self.config.nostartstop): |
786 StopInstanceCommand(self.logger).stop_instance(appid) |
787 StopInstanceCommand(self.logger).stop_instance(appid) |
787 # run cubicweb/componants migration scripts |
788 # run cubicweb/componants migration scripts |
788 if self.config.fs_only or toupgrade: |
789 if self.config.fs_only or toupgrade: |
789 for cube, fromversion, toversion in toupgrade: |
790 for cube, fromversion, toversion in toupgrade: |
790 print '-> migration needed from %s to %s for %s' % (fromversion, toversion, cube) |
791 print '-> migration needed from %s to %s for %s' % (fromversion, toversion, cube) |
797 # handle i18n upgrade |
798 # handle i18n upgrade |
798 if not self.i18nupgrade(config): |
799 if not self.i18nupgrade(config): |
799 return |
800 return |
800 print |
801 print |
801 print '-> instance migrated.' |
802 print '-> instance migrated.' |
802 if not (CWDEV or self.config.nostartstop): |
803 if instance_running and not (CWDEV or self.config.nostartstop): |
803 # restart instance through fork to get a proper environment, avoid |
804 # restart instance through fork to get a proper environment, avoid |
804 # uicfg pb (and probably gettext catalogs, to check...) |
805 # uicfg pb (and probably gettext catalogs, to check...) |
805 forkcmd = '%s start %s' % (sys.argv[0], appid) |
806 forkcmd = '%s start %s' % (sys.argv[0], appid) |
806 status = system(forkcmd) |
807 status = system(forkcmd) |
807 if status: |
808 if status: |