cwctl.py
changeset 5021 58e89f3dfbae
parent 4798 d5bd706e9005
child 5025 2826f5406201
equal deleted inserted replaced
5017:b2cc2a51706f 5021:58e89f3dfbae
    83         some instances depends on another as external source).
    83         some instances depends on another as external source).
    84 
    84 
    85         Instance used by another one should appears first in the file (one
    85         Instance used by another one should appears first in the file (one
    86         instance per line)
    86         instance per line)
    87         """
    87         """
    88         regdir = cwcfg.registry_dir()
    88         regdir = cwcfg.instances_dir()
    89         _allinstances = list_instances(regdir)
    89         _allinstances = list_instances(regdir)
    90         if isfile(join(regdir, 'startorder')):
    90         if isfile(join(regdir, 'startorder')):
    91             allinstances = []
    91             allinstances = []
    92             for line in file(join(regdir, 'startorder')):
    92             for line in file(join(regdir, 'startorder')):
    93                 line = line.strip()
    93                 line = line.strip()
   301                         print '    '+ '    \n'.join(shortdesc.splitlines())
   301                         print '    '+ '    \n'.join(shortdesc.splitlines())
   302                     modes = detect_available_modes(cwcfg.cube_dir(cube))
   302                     modes = detect_available_modes(cwcfg.cube_dir(cube))
   303                     print '    available modes: %s' % ', '.join(modes)
   303                     print '    available modes: %s' % ', '.join(modes)
   304         print
   304         print
   305         try:
   305         try:
   306             regdir = cwcfg.registry_dir()
   306             regdir = cwcfg.instances_dir()
   307         except ConfigurationError, ex:
   307         except ConfigurationError, ex:
   308             print 'No instance available:', ex
   308             print 'No instance available:', ex
   309             print
   309             print
   310             return
   310             return
   311         instances = list_instances(regdir)
   311         instances = list_instances(regdir)
   610     """
   610     """
   611     name = 'restart'
   611     name = 'restart'
   612     actionverb = 'restarted'
   612     actionverb = 'restarted'
   613 
   613 
   614     def run_args(self, args, askconfirm):
   614     def run_args(self, args, askconfirm):
   615         regdir = cwcfg.registry_dir()
   615         regdir = cwcfg.instances_dir()
   616         if not isfile(join(regdir, 'startorder')) or len(args) <= 1:
   616         if not isfile(join(regdir, 'startorder')) or len(args) <= 1:
   617             # no specific startorder
   617             # no specific startorder
   618             super(RestartInstanceCommand, self).run_args(args, askconfirm)
   618             super(RestartInstanceCommand, self).run_args(args, askconfirm)
   619             return
   619             return
   620         print ('some specific start order is specified, will first stop all '
   620         print ('some specific start order is specified, will first stop all '
   956     name = 'listinstances'
   956     name = 'listinstances'
   957     hidden = True
   957     hidden = True
   958 
   958 
   959     def run(self, args):
   959     def run(self, args):
   960         """run the command with its specific arguments"""
   960         """run the command with its specific arguments"""
   961         regdir = cwcfg.registry_dir()
   961         regdir = cwcfg.instances_dir()
   962         for appid in sorted(listdir(regdir)):
   962         for appid in sorted(listdir(regdir)):
   963             print appid
   963             print appid
   964 
   964 
   965 
   965 
   966 class ListCubesCommand(Command):
   966 class ListCubesCommand(Command):