[WIP] include SEA info (2)
This commit is contained in:
parent
b7ab2f4656
commit
79ce2947a6
21
frappyman.py
21
frappyman.py
@ -106,7 +106,7 @@ class FrappyManager(ServiceManager):
|
||||
raise UsageError('need service to start (one of %s)' % ', '.join(self.services))
|
||||
if cfg.startswith('~'):
|
||||
cfg = cfg[1:]
|
||||
seacfg = SeaManager().guess_frappy_cfg(ins).get(service)
|
||||
seacfg = self.cfg_from_sea(ins).get(service)
|
||||
if seacfg:
|
||||
cfg = seacfg
|
||||
if not cfg:
|
||||
@ -237,3 +237,22 @@ class FrappyManager(ServiceManager):
|
||||
cfg in self.all_cfg(argdict.get('ins'), argdict.get('service'))):
|
||||
return super().treat_args(argdict, (), unknown)
|
||||
return super().treat_args(argdict, unknown, extra)
|
||||
|
||||
def cfg_from_sea(self, ins):
|
||||
sea = SeaManager()
|
||||
sea.get_info()
|
||||
cfgs = sea.get_cfg(ins, 'sea').split('/')
|
||||
result = {}
|
||||
if cfgs[0] and cfgs[0] in self.all_cfg(ins, 'main'):
|
||||
result['main'] = cfgs[0]
|
||||
allsticks = self.all_cfg(ins, 'stick')
|
||||
stick = cfgs[:2][-1]
|
||||
if stick:
|
||||
for s in (stick + 'stick', stick):
|
||||
if s in allsticks:
|
||||
result['stick'] = s
|
||||
break
|
||||
addons = [a for a in cfgs[2:] if a in self.all_cfg(ins, 'addons')]
|
||||
if addons:
|
||||
result['addons'] = ','.join(addons)
|
||||
return result
|
||||
|
18
seaman.py
18
seaman.py
@ -174,21 +174,3 @@ class SeaManager(ServiceManager):
|
||||
else:
|
||||
raise UsageError('unknown argument: %s' % arg)
|
||||
return [argdict.pop('ins', '')] + extra
|
||||
|
||||
def guess_frappy_cfg(self, ins):
|
||||
self.get_info()
|
||||
cfgs = self.get_cfg(ins, 'sea').split('/')
|
||||
result = {}
|
||||
if cfgs[0] and cfgs[0] in self.all_cfg(ins, 'main'):
|
||||
result['main'] = cfgs[0]
|
||||
allsticks = self.all_cfg(ins, 'stick')
|
||||
stick = cfgs[:2][-1]
|
||||
if stick:
|
||||
for s in (stick + 'stick', stick):
|
||||
if s in allsticks:
|
||||
result['stick'] = s
|
||||
break
|
||||
addons = [a for a in cfgs[2:] if a in self.all_cfg(ins, 'addons')]
|
||||
if addons:
|
||||
result['addons'] = ','.join(addons)
|
||||
return result
|
||||
|
Loading…
x
Reference in New Issue
Block a user