fix invert sea_info
This commit is contained in:
parent
0d026c91de
commit
3d8f220182
13
frappyman.py
13
frappyman.py
@ -100,10 +100,15 @@ def summarize_server_state(givencfgs, ourcfgs, sealist, sea_info, strict=False):
|
|||||||
addons = set()
|
addons = set()
|
||||||
seacfgs = {}
|
seacfgs = {}
|
||||||
remarks = {}
|
remarks = {}
|
||||||
|
inverted = defaultdict(set)
|
||||||
|
all_of = defaultdict(set)
|
||||||
|
for cfg, seacfg in sea_info.items():
|
||||||
|
inverted[seacfg].add(cfg)
|
||||||
|
all_of[seacfg.rsplit('.', 1)[-1]].add(cfg)
|
||||||
for seacfg, seacfgfile, key in zip_longest(sealist, seacfgfiles, ('main', 'stick')):
|
for seacfg, seacfgfile, key in zip_longest(sealist, seacfgfiles, ('main', 'stick')):
|
||||||
if not seacfg:
|
if not seacfg:
|
||||||
continue
|
continue
|
||||||
available = sea_info.get(seacfg + SEAEXT.get(key, '.addon'))
|
available = inverted[seacfg + SEAEXT.get(key, '.addon')]
|
||||||
if available:
|
if available:
|
||||||
proposed = list(available)[0] if len(available) == 1 else None
|
proposed = list(available)[0] if len(available) == 1 else None
|
||||||
if not proposed:
|
if not proposed:
|
||||||
@ -142,10 +147,6 @@ def summarize_server_state(givencfgs, ourcfgs, sealist, sea_info, strict=False):
|
|||||||
remarks[pkey] = 'missing frappy config'
|
remarks[pkey] = 'missing frappy config'
|
||||||
error = True
|
error = True
|
||||||
restart = set()
|
restart = set()
|
||||||
available = {s: set() for s in ('.config', '.stick', '.addon')}
|
|
||||||
for seacfg, cfg in sea_info.items():
|
|
||||||
ext = seacfg.rsplit('.', 1)[-1]
|
|
||||||
available[ext].add(cfg)
|
|
||||||
for key, running in frappycfgs.items():
|
for key, running in frappycfgs.items():
|
||||||
if running:
|
if running:
|
||||||
if key in ('main', 'stick'):
|
if key in ('main', 'stick'):
|
||||||
@ -154,7 +155,7 @@ def summarize_server_state(givencfgs, ourcfgs, sealist, sea_info, strict=False):
|
|||||||
service = 'addons'
|
service = 'addons'
|
||||||
addons.add(running)
|
addons.add(running)
|
||||||
if not seacfgs.get(key):
|
if not seacfgs.get(key):
|
||||||
if running in available[SEAEXT.get(key, '.addon')]:
|
if running in all_of[SEAEXT.get(key, '.addon')]:
|
||||||
restart.add(service)
|
restart.add(service)
|
||||||
remarks[key] = 'restart to start sea'
|
remarks[key] = 'restart to start sea'
|
||||||
elif givencfgs.get(key) != running:
|
elif givencfgs.get(key) != running:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user