From 47e6d60216ba6b3c86acb4097d04a454c9d0e723 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 3 Mar 2020 18:25:56 +0100 Subject: interfaces: T1579: fix c/p error when evaluating os.environ['VYOS_TAGNODE_VALUE'] This has been only a theoretical problem but then the error condition was triggered - only an error has been printed instead of raising an Exception. --- src/conf_mode/interfaces-pppoe.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/conf_mode/interfaces-pppoe.py') diff --git a/src/conf_mode/interfaces-pppoe.py b/src/conf_mode/interfaces-pppoe.py index 8448bc198..8ec78bab3 100755 --- a/src/conf_mode/interfaces-pppoe.py +++ b/src/conf_mode/interfaces-pppoe.py @@ -133,11 +133,11 @@ def get_config(): base_path = ['interfaces', 'pppoe'] # determine tagNode instance - try: - pppoe['intf'] = os.environ['VYOS_TAGNODE_VALUE'] - pppoe['logfile'] = PPP_LOGFILE.format(pppoe['intf']) - except KeyError as E: - print("Interface not specified") + if 'VYOS_TAGNODE_VALUE' not in os.environ: + raise ConfigError('Interface (VYOS_TAGNODE_VALUE) not specified') + + pppoe['intf'] = os.environ['VYOS_TAGNODE_VALUE'] + pppoe['logfile'] = PPP_LOGFILE.format(pppoe['intf']) # Check if interface has been removed if not conf.exists(base_path + [pppoe['intf']]): -- cgit v1.2.3