allow options to the commands

especially -v for frappy
This commit is contained in:
l_samenv
2024-02-23 10:45:34 +01:00
parent d8bb4999dc
commit 0b099bab28
2 changed files with 19 additions and 9 deletions

View File

@ -286,7 +286,7 @@ class ServiceManager:
env = self.env[ins]
return env.get('%s_ROOT' % gr, ''), env
def do_start(self, ins, service=None, cfg='', restart=False, wait=False, logger=None):
def do_start(self, ins, service=None, cfg='', restart=False, wait=False, logger=None, opts=''):
ins_list = self.wildcard(ins)
if ins_list is not None:
return ins_list
@ -326,6 +326,8 @@ class ServiceManager:
for service_i in services:
port = service_ports[service_i]
cmd = self.commands[ins] % dict(ins=ins, serv=service_i, port=port, cfg=cfg, pkg=self.pkg)
if opts:
cmd = f'{cmd} {opts}'
if '%(cfg)s' in self.commands[ins] and not cfg:
cmd = self.stopped[ins].get(service_i)
if not cmd:
@ -394,7 +396,7 @@ class ServiceManager:
return ins_list
self.do_start(ins, service, cfg, True, logger=logger)
def do_run(self, ins, service=None, cfg=None):
def do_run(self, ins, service=None, cfg=None, opts=''):
"""for tests: run and wait"""
if self.wildcard(ins) is not None:
raise UsageError('no wildcards allowed with %s run' % self.group)
@ -403,7 +405,7 @@ class ServiceManager:
service, = self.services
except ValueError:
raise UsageError('need service to start (one of %s)' % ', '.join(self.services))
self.do_start(ins, service, cfg, wait=True)
self.do_start(ins, service, cfg, wait=True, opts=opts)
def do_list(self, ins=None, *args):
"""info about running services"""