better message when server is not running
when a client is started and the server is not running, issue 'please use ".. start .."' message
This commit is contained in:
parent
9900af0e3f
commit
3748948b5d
@ -63,8 +63,8 @@ def run(group, arglist):
|
|||||||
return
|
return
|
||||||
action = arglist.pop(0) if hasattr(serv, 'do_' + arglist[0]) else 'gui'
|
action = arglist.pop(0) if hasattr(serv, 'do_' + arglist[0]) else 'gui'
|
||||||
instance = arglist.pop(0) if arglist[0] and arglist[0] not in serv.services else None
|
instance = arglist.pop(0) if arglist[0] and arglist[0] not in serv.services else None
|
||||||
if instance is None and len(serv.info) == 1:
|
if instance is None and serv.main_ins:
|
||||||
instance = list(serv.info)[0]
|
instance = serv.main_ins
|
||||||
if instance is not None:
|
if instance is not None:
|
||||||
arglist.insert(0, instance)
|
arglist.insert(0, instance)
|
||||||
arglist.pop() # remove dummy argument
|
arglist.pop() # remove dummy argument
|
||||||
|
10
base.py
10
base.py
@ -83,7 +83,7 @@ class ServiceManager:
|
|||||||
pkg = ''
|
pkg = ''
|
||||||
revcmd = {}
|
revcmd = {}
|
||||||
USAGE = None
|
USAGE = None
|
||||||
main_instrument = basename(expanduser('~'))
|
main_ins = basename(expanduser('~'))
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.env = {}
|
self.env = {}
|
||||||
@ -137,7 +137,7 @@ class ServiceManager:
|
|||||||
for ins in parser.sections():
|
for ins in parser.sections():
|
||||||
section = dict(parser[ins])
|
section = dict(parser[ins])
|
||||||
if ins == 'MAIN':
|
if ins == 'MAIN':
|
||||||
ins = self.main_instrument
|
ins = self.main_ins
|
||||||
command = section.get('%s_command' % self.group)
|
command = section.get('%s_command' % self.group)
|
||||||
self.revcmd[command] = self.group
|
self.revcmd[command] = self.group
|
||||||
nr = section.get(self.group)
|
nr = section.get(self.group)
|
||||||
@ -193,7 +193,7 @@ class ServiceManager:
|
|||||||
match = cmdpat.match(cmd)
|
match = cmdpat.match(cmd)
|
||||||
if match:
|
if match:
|
||||||
gdict = match.groupdict()
|
gdict = match.groupdict()
|
||||||
ins = gdict.get('ins', self.main_instrument)
|
ins = gdict.get('ins', self.main_ins)
|
||||||
serv = gdict.get('serv', '')
|
serv = gdict.get('serv', '')
|
||||||
if cfginfo is not None and 'cfg' in gdict:
|
if cfginfo is not None and 'cfg' in gdict:
|
||||||
cfginfo[ins, serv] = gdict['cfg']
|
cfginfo[ins, serv] = gdict['cfg']
|
||||||
@ -204,8 +204,10 @@ class ServiceManager:
|
|||||||
self.get_info()
|
self.get_info()
|
||||||
if ins not in self.info:
|
if ins not in self.info:
|
||||||
raise KeyError("don't know %r" % ins)
|
raise KeyError("don't know %r" % ins)
|
||||||
|
sp_ins = ' ' + ins if ins != self.main_ins else ''
|
||||||
if not self.get_procs().get(ins, {}).get(service):
|
if not self.get_procs().get(ins, {}).get(service):
|
||||||
raise ServiceDown('%s %s is not running' % (service, ins))
|
startcmd = '%s start%s' % (self.group, sp_ins)
|
||||||
|
raise ServiceDown('%s%s is not running - please use %r' % (self.group, sp_ins, startcmd))
|
||||||
|
|
||||||
def stop(self, ins, service=None):
|
def stop(self, ins, service=None):
|
||||||
"""stop service (or all services) of instance <ins>"""
|
"""stop service (or all services) of instance <ins>"""
|
||||||
|
@ -78,6 +78,7 @@ class SeaManager(ServiceManager):
|
|||||||
except ServiceDown as e:
|
except ServiceDown as e:
|
||||||
self.usage()
|
self.usage()
|
||||||
print(str(e))
|
print(str(e))
|
||||||
|
return
|
||||||
except KeyError: # running on an other machine?
|
except KeyError: # running on an other machine?
|
||||||
self.usage()
|
self.usage()
|
||||||
run_command('SeaClient %s' % ins)
|
run_command('SeaClient %s' % ins)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user