diff --git a/frappyman.py b/frappyman.py index acca2ff..4457c6a 100644 --- a/frappyman.py +++ b/frappyman.py @@ -98,7 +98,17 @@ class FrappyManager(ServiceManager): is one of main, stick, addons %(legend)s """ - sea_info = None + # changed in all_info (see docstring there) + frappy2sea = None + sea2frappy = None + list_info = None + # changed in get_server_state: + frappy_cfgs = None + sea_cfgs = None + state = None + error = None + remarks = None + sea = None def config_dirs(self, ins, service): cfgpaths = [] @@ -199,7 +209,9 @@ class FrappyManager(ServiceManager): init(*nodes) interact() - def get_cfg_details(self, namespace, cfgfile): + @staticmethod + def get_cfg_details(namespace, cfgfile): + # get sea_cfg option from frappy cfg file namespace.init() local = {} with open(cfgfile, encoding='utf-8') as f: @@ -229,8 +241,10 @@ class FrappyManager(ServiceManager): :param details: get details about relation to sea :return: see param:`what` - sea_info: is a dict of (including extension .config/.stick/.addon) - list_info: dict of of + implicit results: + self.frappy2sea: a dict of (including extension .config/.stick/.addon) + self.sea2frappy: a dict of set of + self.list_info: dict of of """ all_cfg = set() if not ins: @@ -326,17 +340,22 @@ class FrappyManager(ServiceManager): :param ins: the instance to be checked for :param givencfgs: a dict of cfg given by the ECS + :return: a dict of cfg, where cfg is either: + - a bare string: this cfg is proposed to change to this value + - Reconnect(cfg): the frappy server is running as expected, but the given cfg does not match + - Keep(cfg): no change needed + remark: Reconnect amd Keep inherit from str, so Reconnect(cfg) == cfg is always True - TODO: update this doc - :return: tuple (, , (, ), where: - : proposed config not sure - : dict of proposed cfg - : dict of items running in frappy servers (addons are separated) - : dict of items running on the sea server - : dict of actions to do / remarks + implicit results: + self.remarks: a dict of remark (why should this be changed?) + self.frappy_cfgs: a dict of running cfgs + self.sea_cfgs: a dict of sea cfgs (without ending .config/.stick/.addon) + self.state: a dict ('sea ' | 'frappy ') of cfg summarizing the state of all servers + a change of self.state indicates that the configuration may need to be reevaluated + self.error: there is an ambiguity for the mapping seacfg -> frappycfg + self.sea: a fresh SeaManager instance """ self.frappy_cfgs = self.get_cfg(ins, None) # dict of running frappy servers - self.sea = SeaManager() seaconfig = self.sea.get_cfg(ins, 'sea') sealist = seaconfig.split('/') # , , , ...