try to fix the case the *_ROOT dir is not in sys.path
This commit is contained in:
7
base.py
7
base.py
@@ -302,7 +302,10 @@ class ServiceManager:
|
||||
if not ins:
|
||||
raise UsageError('need instance')
|
||||
env = self.env[ins]
|
||||
return env.get('%s_ROOT' % gr, ''), env
|
||||
startdir = env.get('%s_ROOT' % gr, '')
|
||||
if startdir not in sys.path:
|
||||
sys.path.insert(0, startdir)
|
||||
return startdir, env
|
||||
|
||||
def do_start(self, ins, service=None, cfg='', restart=False, wait=False, logger=None, opts=''):
|
||||
if not ins:
|
||||
@@ -367,8 +370,6 @@ class ServiceManager:
|
||||
start_dir, env = self.prepare_start(ins, service_i, cfg)
|
||||
env = dict(os.environ, **env, Instrument=ins)
|
||||
os.chdir(start_dir)
|
||||
if start_dir not in sys.path:
|
||||
sys.path.insert(0, start_dir)
|
||||
nicosenv = '/home/nicos/nicos/nicosenv/bin/'
|
||||
if exists(nicosenv):
|
||||
env['PATH'] = f"{nicosenv}:{env['PATH']}"
|
||||
|
||||
11
frappyman.py
11
frappyman.py
@@ -46,7 +46,11 @@ class Config:
|
||||
def get(cls, cfgfile):
|
||||
if not cls.process_file:
|
||||
import logging
|
||||
from frappy.config import process_file
|
||||
try:
|
||||
from frappy.config import process_file
|
||||
except Exception as e:
|
||||
print(sys.path)
|
||||
raise
|
||||
from frappy.lib import generalConfig
|
||||
generalConfig.init()
|
||||
cls.log = logging.getLogger('frappyman')
|
||||
@@ -165,9 +169,7 @@ class FrappyManager(ServiceManager):
|
||||
return [i for i in ins_list if i in cfgs]
|
||||
|
||||
def get_nodes(self, ins='', service=None):
|
||||
start_dir = ServiceManager.prepare_start(self, ins, None)[0]
|
||||
if start_dir not in sys.path:
|
||||
sys.path.insert(0, start_dir)
|
||||
ServiceManager.prepare_start(self, ins, None)
|
||||
nodes = []
|
||||
services = self.services if service is None else [service]
|
||||
for service in services:
|
||||
@@ -301,6 +303,7 @@ class FrappyManager(ServiceManager):
|
||||
def do_listcfg(self, ins='', service='', prt=print):
|
||||
if not ins:
|
||||
raise UsageError('missing instance')
|
||||
ServiceManager.prepare_start(self, ins, service)
|
||||
self.all_cfg(ins, service, True)
|
||||
seacfgpat = re.compile(r'(.*)(\.config|\.stick|\.addon)')
|
||||
keylen = max((max(len(k) for k in cfgs) for cfgs in self.list_info.values()), default=1)
|
||||
|
||||
Reference in New Issue
Block a user