From e8b9eaddb5d8ddae8710a579676beade73fce1a8 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Mon, 6 Apr 2020 07:27:59 +0200 Subject: lldp: use vyos.version over handcrafted open().read().split() code --- src/conf_mode/lldp.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/conf_mode') diff --git a/src/conf_mode/lldp.py b/src/conf_mode/lldp.py index dd0b1ba0b..4e3dfc0b6 100755 --- a/src/conf_mode/lldp.py +++ b/src/conf_mode/lldp.py @@ -24,6 +24,7 @@ from sys import exit from vyos.config import Config from vyos.validate import is_addr_assigned,is_loopback_addr from vyos.defaults import directories as vyos_data_dir +from vyos.version import get_version_data from vyos import ConfigError config_file = "/etc/default/lldpd" @@ -67,7 +68,8 @@ def get_options(config): options['sonmp'] = config.exists('sonmp') # start with an unknown version information - options['description'] = 'unknown' + version_data = get_version_data() + options['description'] = version_data['version'] options['listen_on'] = [] return options @@ -211,10 +213,6 @@ def generate(lldp): fs_loader = FileSystemLoader(tmpl_path) env = Environment(loader=fs_loader) - with open('/opt/vyatta/etc/version', 'r') as f: - tmp = f.read() - lldp['options']['description'] = tmp.split()[1] - # generate listen on interfaces for intf in lldp['interface_list']: tmp = '' -- cgit v1.2.3