added config_dirs methed to FrappyManager

This commit is contained in:
l_samenv 2021-04-09 13:57:05 +02:00
parent 4fb55323e3
commit c7584d70b1
3 changed files with 18 additions and 4 deletions

View File

@ -230,7 +230,6 @@ class ServiceManager:
print_wait = False print_wait = False
continue continue
self.stopped[ins][service] = ' '.join(p.info['cmdline']) self.stopped[ins][service] = ' '.join(p.info['cmdline'])
done = True
break break
else: else:
if action == 'kill': if action == 'kill':
@ -238,6 +237,7 @@ class ServiceManager:
break break
continue continue
break break
done = True
print('%s %s %s' % (ins, service, (action + 'ed').replace('eed', 'ed'))) print('%s %s %s' % (ins, service, (action + 'ed').replace('eed', 'ed')))
return done return done

View File

@ -20,7 +20,9 @@
# #
# ***************************************************************************** # *****************************************************************************
#import os import sys
import os
from os.path import join
from servicemanager.base import ServiceManager, ServiceDown, UsageError from servicemanager.base import ServiceManager, ServiceDown, UsageError
@ -39,14 +41,26 @@ class FrappyManager(ServiceManager):
%s %s
""" """
def config_dirs(self, ins, service):
cfgpaths = []
for cfgpath in self.env[ins].get('SECOP_CONFDIR', '').split(os.pathsep):
cfgpaths.extend([join(cfgpath, service), cfgpath])
return cfgpaths
def prepare_start(self, ins, service): def prepare_start(self, ins, service):
start_dir, env = super().prepare_start(ins, service) start_dir, env = super().prepare_start(ins, service)
his = env.get('FRAPPY_HISTORY') his = env.get('FRAPPY_HISTORY')
if his: if his:
env['FRAPPY_HISTORY'] = his.replace('_SERVICE', '_' + service) env['FRAPPY_HISTORY'] = his.replace('_SERVICE', '_' + service)
cfgpaths = self.config_dirs(ins, service)
if cfgpaths:
env['SECOP_CONFDIR'] = os.pathsep.join(cfgpaths)
print(env['SECOP_CONFDIR'])
return start_dir, env return start_dir, env
def do_gui(self, ins='', service='main'): def do_gui(self, ins='', service='main'):
start_dir, env = self.prepare_start(ins, service)
sys.path.insert(0, start_dir)
try: try:
self.check_running(ins, service) self.check_running(ins, service)
except ServiceDown as e: except ServiceDown as e:

View File

@ -51,8 +51,8 @@ class SeaManager(ServiceManager):
Usage: Usage:
sea gui <instance> sea gui <instance>
sea <instance> # the same as sea gui <instance> sea <instance> # the same as sea gui <instance>
sea cli <instance> # the same as old seacmd sea cli <instance> # the same as old seacmd
sea start <instance> [<service>] sea start <instance> [<service>]
sea restart <instance> [<service>] sea restart <instance> [<service>]
sea stop <instance> [<service>] sea stop <instance> [<service>]