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:
10
base.py
10
base.py
@ -83,7 +83,7 @@ class ServiceManager:
|
||||
pkg = ''
|
||||
revcmd = {}
|
||||
USAGE = None
|
||||
main_instrument = basename(expanduser('~'))
|
||||
main_ins = basename(expanduser('~'))
|
||||
|
||||
def __init__(self):
|
||||
self.env = {}
|
||||
@ -137,7 +137,7 @@ class ServiceManager:
|
||||
for ins in parser.sections():
|
||||
section = dict(parser[ins])
|
||||
if ins == 'MAIN':
|
||||
ins = self.main_instrument
|
||||
ins = self.main_ins
|
||||
command = section.get('%s_command' % self.group)
|
||||
self.revcmd[command] = self.group
|
||||
nr = section.get(self.group)
|
||||
@ -193,7 +193,7 @@ class ServiceManager:
|
||||
match = cmdpat.match(cmd)
|
||||
if match:
|
||||
gdict = match.groupdict()
|
||||
ins = gdict.get('ins', self.main_instrument)
|
||||
ins = gdict.get('ins', self.main_ins)
|
||||
serv = gdict.get('serv', '')
|
||||
if cfginfo is not None and 'cfg' in gdict:
|
||||
cfginfo[ins, serv] = gdict['cfg']
|
||||
@ -204,8 +204,10 @@ class ServiceManager:
|
||||
self.get_info()
|
||||
if ins not in self.info:
|
||||
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):
|
||||
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):
|
||||
"""stop service (or all services) of instance <ins>"""
|
||||
|
Reference in New Issue
Block a user