[WIP] bug fix: sealist / seacfgs are different

This commit is contained in:
2023-10-17 11:11:24 +02:00
parent 7cc025bef4
commit 14c7100ca8

View File

@ -170,12 +170,12 @@ def make_proposed(givencfgs, ourcfgs, seacfgs, sea_info, strict=False, giventitl
return result, [' '.join(v.ljust(w) for w, v in zip(wid, row)) for row in rows] return result, [' '.join(v.ljust(w) for w, v in zip(wid, row)) for row in rows]
def summarize_server_state(givencfgs, ourcfgs, seacfgs, sea_info, strict=False): def summarize_server_state(givencfgs, ourcfgs, sealist, sea_info, strict=False):
"""get a guess for the configuration from information about running services """get a guess for the configuration from information about running services
:param givencfgs: dict <service> of given configuration (from nicos cache) :param givencfgs: dict <service> of given configuration (from nicos cache)
:param outcfgs: dict <service> of running configuration (frappy) :param outcfgs: dict <service> of running configuration (frappy)
:param seacfgs: dict <service> of running configuration (sea) :param sealist: list of running sea configuration
:param sea_info: dict <frappycfg> of <seacfg> with info about sea configs :param sea_info: dict <frappycfg> of <seacfg> with info about sea configs
:param strict: when True return empty cfg result on error :param strict: when True return empty cfg result on error
:return: tuple (<error>, <proposed>, (<frappyitems>, <seaitems>), (<givenitems>, <remarks>) where: :return: tuple (<error>, <proposed>, (<frappyitems>, <seaitems>), (<givenitems>, <remarks>) where:
@ -200,7 +200,7 @@ def summarize_server_state(givencfgs, ourcfgs, seacfgs, sea_info, strict=False):
frappycfgs[addon] = addon frappycfgs[addon] = addon
seacfgfiles = [(c or '') + SEAEXT.get(s, '.addon') seacfgfiles = [(c or '') + SEAEXT.get(s, '.addon')
for c, s in zip_longest(seacfgs, FrappyManager.services)] for c, s in zip_longest(sealist, FrappyManager.services)]
seacfgset = set(seacfgfiles) seacfgset = set(seacfgfiles)
inverted_sea_info = {k: [] for k in seacfgfiles} inverted_sea_info = {k: [] for k in seacfgfiles}
for cfg, seacfg in sea_info.items(): for cfg, seacfg in sea_info.items():
@ -211,7 +211,7 @@ def summarize_server_state(givencfgs, ourcfgs, seacfgs, sea_info, strict=False):
addons = set() addons = set()
seacfgs = {} seacfgs = {}
remarks = {} remarks = {}
for seacfg, seacfgfile, key in zip_longest(seacfgs, seacfgfiles, ('main', 'stick')): for seacfg, seacfgfile, key in zip_longest(sealist, seacfgfiles, ('main', 'stick')):
if not seacfg: if not seacfg:
continue continue
available = inverted_sea_info[seacfgfile] available = inverted_sea_info[seacfgfile]
@ -247,7 +247,7 @@ def summarize_server_state(givencfgs, ourcfgs, seacfgs, sea_info, strict=False):
error = True error = True
else: else:
pkey = key or seacfg pkey = key or seacfg
seacfg[pkey] = seacfg seacfgs[pkey] = seacfg
remarks[pkey] = 'missing frappy config' remarks[pkey] = 'missing frappy config'
error = True error = True
restart = set() restart = set()