fix bug when restarting all frappy services
- return a copy of the modified env dict instread of modifiying in place
This commit is contained in:
@ -83,21 +83,22 @@ class FrappyManager(ServiceManager):
|
|||||||
|
|
||||||
def prepare_start(self, ins, service, cfg=''):
|
def prepare_start(self, ins, service, cfg=''):
|
||||||
start_dir, env = super().prepare_start(ins, service)
|
start_dir, env = super().prepare_start(ins, service)
|
||||||
|
env_update = {}
|
||||||
for key, value in env.items():
|
for key, value in env.items():
|
||||||
if '<SERV>' in value:
|
if '<SERV>' in value:
|
||||||
env[key] = value.replace('<SERV>', service)
|
env_update[key] = value.replace('<SERV>', service)
|
||||||
os.environ[key] = env[key]
|
os.environ[key] = env[key]
|
||||||
cfgpaths = self.config_dirs(ins, service)
|
cfgpaths = self.config_dirs(ins, service)
|
||||||
if cfgpaths:
|
if cfgpaths:
|
||||||
env['FRAPPY_CONFDIR'] = os.pathsep.join(cfgpaths)
|
env_update['FRAPPY_CONFDIR'] = os.pathsep.join(cfgpaths)
|
||||||
# merge PYTHONPATH from servicemanager.cfg with the one from environment
|
# merge PYTHONPATH from servicemanager.cfg with the one from environment
|
||||||
pypathlist = []
|
pypathlist = []
|
||||||
for pypath in env.get('PYTHONPATH'), os.environ.get('PYTHONPATH'):
|
for pypath in env.get('PYTHONPATH'), os.environ.get('PYTHONPATH'):
|
||||||
if pypath is not None:
|
if pypath is not None:
|
||||||
pypathlist.extend(p for p in pypath.split(':') if p not in pypathlist)
|
pypathlist.extend(p for p in pypath.split(':') if p not in pypathlist)
|
||||||
if pypathlist:
|
if pypathlist:
|
||||||
env['PYTHONPATH'] = os.environ['PYTHONPATH'] = ':'.join(pypathlist)
|
env_update['PYTHONPATH'] = os.environ['PYTHONPATH'] = ':'.join(pypathlist)
|
||||||
return start_dir, env
|
return start_dir, dict(env, **env_update)
|
||||||
|
|
||||||
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):
|
||||||
if self.wildcard(ins) is not None:
|
if self.wildcard(ins) is not None:
|
||||||
|
Reference in New Issue
Block a user