From 48ddea3755c72db55e5366997a82d725e106c3aa Mon Sep 17 00:00:00 2001 From: fmertz Date: Sun, 5 Jul 2020 15:01:21 +0000 Subject: system display: T2564: Dictionary code update * src/conf_mode/system-display.py added get_first_key to dictionary call --- src/conf_mode/system-display.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/conf_mode/system-display.py b/src/conf_mode/system-display.py index 9ab35a331..3eafc30c0 100755 --- a/src/conf_mode/system-display.py +++ b/src/conf_mode/system-display.py @@ -27,18 +27,11 @@ from vyos import airbag airbag.enable() def get_config(): + conf = Config() + base = ['system', 'display'] + display = conf.get_config_dict(base, key_mangling=('-', '_'), get_first_key=True) # Return a (possibly empty) configuration dictionary - return Config().get_config_dict(['system', 'display']) - -def generate(config_dict): - if not config_dict: - return None - # Render config file for daemon LCDd - render('/run/LCDd/LCDd.lo.conf', 'system-display/LCDd.conf.tmpl', config_dict) - # Render config file for client lcdproc - render('/run/lcdproc/lcdproc.lo.conf', 'system-display/lcdproc.conf.tmpl', config_dict) - - return None + return display def verify(config_dict): if not config_dict: @@ -68,6 +61,16 @@ def verify(config_dict): return None +def generate(config_dict): + if not config_dict: + return None + # Render config file for daemon LCDd + render('/run/LCDd/LCDd.lo.conf', 'system-display/LCDd.conf.tmpl', config_dict) + # Render config file for client lcdproc + render('/run/lcdproc/lcdproc.lo.conf', 'system-display/lcdproc.conf.tmpl', config_dict) + + return None + def apply(config_dict): # Stop client run('systemctl stop lcdproc@lo.service') -- cgit v1.2.3