[WIP] remove givencfgs from result
This commit is contained in:
parent
7e34c6f6cd
commit
ac4e6f851a
10
frappyman.py
10
frappyman.py
@ -178,12 +178,11 @@ def summarize_server_state(givencfgs, ourcfgs, sealist, sea_info, strict=False):
|
||||
:param sealist: list of running sea configuration
|
||||
:param sea_info: dict <frappycfg> of <seacfg> with info about sea configs
|
||||
: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>), <remarks> where:
|
||||
<error>: proposed config not sure
|
||||
<proposed>: dict <service> of proposed cfg
|
||||
<frappyitems>: dict of items runnning in frappy servers (addons are separated)
|
||||
<seaitems>: dict of items running on the sea server
|
||||
<givenitems>: dict of given items (addons are separated)
|
||||
<remarks>: dict of actions / remarks
|
||||
"""
|
||||
givencfgs = dict(givencfgs)
|
||||
@ -274,7 +273,7 @@ def summarize_server_state(givencfgs, ourcfgs, sealist, sea_info, strict=False):
|
||||
prop = result.get(service, '')
|
||||
if prop == cfg and service not in restart:
|
||||
result[service] = True
|
||||
return error, result, (ourcfgs, seacfgs), (givencfgs, remarks)
|
||||
return error, result, (ourcfgs, seacfgs), remarks
|
||||
|
||||
|
||||
class FrappyManager(ServiceManager):
|
||||
@ -545,13 +544,12 @@ class FrappyManager(ServiceManager):
|
||||
:param ins: the instance to be checked for
|
||||
:param givencfgs: a dict <service> of cfg given by the ECS
|
||||
|
||||
:return: tuple (<error>, <proposed>, (<frappyitems>, <seaitems>), (<givenitems>, <remarks>) where:
|
||||
:return: tuple (<error>, <proposed>, (<frappyitems>, <seaitems>), <remarks> where:
|
||||
<error>: proposed config not sure
|
||||
<proposed>: dict <service> of proposed cfg
|
||||
<frappyitems>: dict of items runnning in frappy servers (addons are separated)
|
||||
<seaitems>: dict of items running on the sea server
|
||||
<givenitems>: dict of given items (addons are separated)
|
||||
<remarks>: dict of actions / remarks
|
||||
<remarks>: dict of actions to do / remarks
|
||||
"""
|
||||
ourcfgs = self.get_cfg(ins, None)
|
||||
sea = SeaManager()
|
||||
|
@ -1,5 +1,5 @@
|
||||
import pytest
|
||||
from servicemanager.frappyman import make_proposed
|
||||
from servicemanager.frappyman import summarize_server_state
|
||||
|
||||
sea_info = {
|
||||
'ma10': 'ma10.config',
|
||||
@ -15,19 +15,13 @@ given = dict(main='ma10', stick='ma10stick')
|
||||
cfgs = dict(given)
|
||||
seacfg = ['ma10', 'ma10']
|
||||
|
||||
@pytest.mark.parametrize('given, current, seacfg, output, proposed, proposedstrict', [
|
||||
@pytest.mark.parametrize('given, current, seacfg, state, proposed', [
|
||||
|
||||
])
|
||||
def test_proposed(given, current, seacfg, output, proposed, proposedstrict):
|
||||
prop, overview = make_proposed(given, current, seacfg, sea_info)
|
||||
assert overview == output
|
||||
assert prop == proposed
|
||||
props, overview = make_proposed(given, current, seacfg, sea_info, True)
|
||||
assert overview == output
|
||||
assert props == proposedstrict
|
||||
def test_proposed(given, current, seacfg, result):
|
||||
assert result == summarize_server_state(given, current, seacfg, sea_info)
|
||||
|
||||
|
||||
def do():
|
||||
prop, tab = make_proposed(given, cfgs, seacfg, sea_info)
|
||||
print(prop)
|
||||
print('\n'.join(tab))
|
||||
result = summarize_server_state(given, cfgs, seacfg, sea_info)
|
||||
print(result)
|
||||
|
Loading…
x
Reference in New Issue
Block a user