diff --git a/commands.py b/commands.py index 372478b..033ec58 100644 --- a/commands.py +++ b/commands.py @@ -125,6 +125,34 @@ def set_se_list(): frappy_config.set_envlist() +@usercommand +@helparglist('main [, stick [, addons]]') +def frappy(main=None, stick=None, addons=None): + """(re)start frappy server(s) with given configs and load setup if needed + + - without argument: list running frappy servers + - frappy(''): if available, the standard stick is added too + - frappy(''): the stick is removed too + - addons are not changed when not given! + """ + all_cfg = {} + if main is not None: + all_cfg = frappy_start('main', main) + if stick is None: + if main: + stickcfg = main + 'stick' + if stickcfg in FrappyNode.available_cfg('stick'): + # if a default stick is available, start this also + stick = stickcfg + else: + stick = '' + if stick is not None: + all_cfg = frappy_stick('stick', stick) + if addons is not None: + all_cfg = frappy_stick('addons', addons) + session.log.info(all_info(all_cfg)) + + @usercommand @helparglist('cfg') def frappy_main(cfg=None): @@ -133,13 +161,7 @@ def frappy_main(cfg=None): - without argument: list running frappy servers - cfg = "": stop frappy_main server """ - all_cfg = frappy_start('main', cfg) - if cfg: - stickcfg = cfg + 'stick' - if stickcfg in FrappyNode.available_cfg('stick'): - # if a default stick is available, start this also - all_cfg = frappy_start('stick', stickcfg) - session.log.info(all_info(all_cfg)) + session.log.info(all_info(frappy_start('main', cfg))) @usercommand diff --git a/devices.py b/devices.py index b75505b..c6d5caa 100644 --- a/devices.py +++ b/devices.py @@ -219,6 +219,9 @@ class FrappyNode(SecNodeDevice, Moveable): } parameters = { 'service': Param('frappy service name (main, stick or addons)', type=str, default=''), + 'param_category': Param("category of parameters\n\n" + "set to 'general' if all parameters should appear in the datafile header", + type=str, default='', settable=True), } _service_manager = FrappyManager() @@ -237,6 +240,17 @@ class FrappyNode(SecNodeDevice, Moveable): self._cfgvalue = self._cache.get(self, 'value') return self._cfgvalue + def createDevices(self): + super().createDevices() + if self.param_category: + for devname, (_, devcfg) in self.setup_info.items(): + params_cfg = devcfg['params_cfg'] + dev = session.devices[devname] + for pname, pargs in params_cfg.items(): + pinfo = dev.parameters[pname] + if not pinfo.category: + pinfo.category = self.param_category + @classmethod def config_dirs(cls, ins, service): sm = cls._service_manager