summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfmertz <fireboxled@gmail.com>2020-07-05 15:01:21 +0000
committerfmertz <fireboxled@gmail.com>2020-07-05 15:56:22 +0000
commit48ddea3755c72db55e5366997a82d725e106c3aa (patch)
tree7e89a263206ac7c7c8222a37863de48bc87c9a5f
parent14e0a2339451492e226869cb977ab858bb1e7f17 (diff)
downloadvyos-1x-48ddea3755c72db55e5366997a82d725e106c3aa.tar.gz
vyos-1x-48ddea3755c72db55e5366997a82d725e106c3aa.zip
system display: T2564: Dictionary code update
* src/conf_mode/system-display.py added get_first_key to dictionary call
-rwxr-xr-xsrc/conf_mode/system-display.py25
1 files changed, 14 insertions, 11 deletions
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')