respect sea cfg and confirmed plugged device
This commit is contained in:
parent
c5a7f4a494
commit
b651ad205f
25
frappyman.py
25
frappyman.py
@ -242,26 +242,27 @@ class FrappyManager(ServiceManager):
|
|||||||
def cfg_from_sea(self, ins):
|
def cfg_from_sea(self, ins):
|
||||||
sea = SeaManager()
|
sea = SeaManager()
|
||||||
sea.get_info()
|
sea.get_info()
|
||||||
cfgs = sea.get_cfg(ins, 'sea').split('/')
|
cfgs, confirmed = sea.get_cfg(ins, 'sea', True)
|
||||||
|
cfgs = cfgs.split('/')
|
||||||
result = {}
|
result = {}
|
||||||
|
|
||||||
def check_cfg_file(self, cfg, allcfg, stick=''):
|
def check_cfg_file(cfg, allcfg):
|
||||||
if cfg in allcfg:
|
if cfg is 'none':
|
||||||
return cfg
|
return ''
|
||||||
if cfg + stick in allcfg:
|
return cfg if cfg in allcfg else cfg + '?'
|
||||||
return cfg + stick
|
|
||||||
return cfg + '?'
|
|
||||||
|
|
||||||
if cfgs[0]:
|
allmain = self.all_cfg(ins, 'main')
|
||||||
result['main'] = check_cfg_file(cfgs[0], self.all_cfg(ins, 'main'))
|
|
||||||
allsticks = self.all_cfg(ins, 'stick')
|
allsticks = self.all_cfg(ins, 'stick')
|
||||||
|
if cfgs[0]:
|
||||||
|
result['main'] = check_cfg_file(cfgs[0], allmain)
|
||||||
if len(cfgs) > 1:
|
if len(cfgs) > 1:
|
||||||
stick = cfgs[1]
|
stick = cfgs[1]
|
||||||
if stick:
|
if stick:
|
||||||
if stick + 'stick' in allsticks:
|
if stick not in allsticks and stick in allmain:
|
||||||
cfg = stick + 'stick'
|
stick += 'stick'
|
||||||
result['stick'] = check_cfg_file(cfg, allsticks)
|
result['stick'] = check_cfg_file(stick, allsticks)
|
||||||
addons = [check_cfg_file(a) for a in cfgs[2:]]
|
addons = [check_cfg_file(a) for a in cfgs[2:]]
|
||||||
if addons:
|
if addons:
|
||||||
result['addons'] = ','.join(addons)
|
result['addons'] = ','.join(addons)
|
||||||
|
result['confirmed'] = confirmed
|
||||||
return result
|
return result
|
||||||
|
@ -111,7 +111,7 @@ class SeaManager(ServiceManager):
|
|||||||
os.system('cp %s ./' % sea_server_src)
|
os.system('cp %s ./' % sea_server_src)
|
||||||
return start_dir, env
|
return start_dir, env
|
||||||
|
|
||||||
def get_cfg(self, ins, service):
|
def get_cfg(self, ins, service, addconfirmed=False):
|
||||||
"""return cfg info about running programs, if relevant
|
"""return cfg info about running programs, if relevant
|
||||||
|
|
||||||
return samenv name
|
return samenv name
|
||||||
@ -145,9 +145,8 @@ class SeaManager(ServiceManager):
|
|||||||
confirmed = dev
|
confirmed = dev
|
||||||
if not result[-1]:
|
if not result[-1]:
|
||||||
result.pop()
|
result.pop()
|
||||||
if confirmed and confirmed != result[0]:
|
result = '/'.join(result)
|
||||||
result[0] = '?'
|
return (result, confirmed) if addconfirmed else result
|
||||||
return '/'.join(result)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return repr(e)
|
return repr(e)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user