cwctl.py
changeset 7591 cb6ece9cdb78
parent 7577 9892937d9041
child 7595 83872394b5d9
equal deleted inserted replaced
7590:a9aad6c25836 7591:cb6ece9cdb78
   797                                'continue anyway?'):
   797                                'continue anyway?'):
   798                 print '-> migration not completed.'
   798                 print '-> migration not completed.'
   799                 return False
   799                 return False
   800         return True
   800         return True
   801 
   801 
       
   802 
       
   803 class ListVersionsInstanceCommand(InstanceCommand):
       
   804     """List versions used by an instance.
       
   805 
       
   806     <instance>...
       
   807       identifiers of the instances to list versions for.
       
   808     """
       
   809     name = 'versions'
       
   810 
       
   811     def versions_instance(self, appid):
       
   812         from logilab.common.changelog import Version
       
   813         config = cwcfg.config_for(appid)
       
   814         # should not raise error if db versions don't match fs versions
       
   815         config.repairing = True
       
   816         if hasattr(config, 'set_sources_mode'):
       
   817             config.set_sources_mode(('migration',))
       
   818         repo = config.migration_handler().repo_connect()
       
   819         vcconf = repo.get_versions()
       
   820         for key in sorted(vcconf):
       
   821             print key+': %s.%s.%s' % vcconf[key]
       
   822 
       
   823 
   802 class ShellCommand(Command):
   824 class ShellCommand(Command):
   803     """Run an interactive migration shell on an instance. This is a python shell
   825     """Run an interactive migration shell on an instance. This is a python shell
   804     with enhanced migration commands predefined in the namespace. An additional
   826     with enhanced migration commands predefined in the namespace. An additional
   805     argument may be given corresponding to a file containing commands to execute
   827     argument may be given corresponding to a file containing commands to execute
   806     in batch mode.
   828     in batch mode.
   959 for cmdcls in (ListCommand,
   981 for cmdcls in (ListCommand,
   960                CreateInstanceCommand, DeleteInstanceCommand,
   982                CreateInstanceCommand, DeleteInstanceCommand,
   961                StartInstanceCommand, StopInstanceCommand, RestartInstanceCommand,
   983                StartInstanceCommand, StopInstanceCommand, RestartInstanceCommand,
   962                ReloadConfigurationCommand, StatusCommand,
   984                ReloadConfigurationCommand, StatusCommand,
   963                UpgradeInstanceCommand,
   985                UpgradeInstanceCommand,
       
   986                ListVersionsInstanceCommand,
   964                ShellCommand,
   987                ShellCommand,
   965                RecompileInstanceCatalogsCommand,
   988                RecompileInstanceCatalogsCommand,
   966                ListInstancesCommand, ListCubesCommand,
   989                ListInstancesCommand, ListCubesCommand,
   967                ):
   990                ):
   968     CWCTL.register(cmdcls)
   991     CWCTL.register(cmdcls)