From 426b5a76e1e251d122d5b2e17c5a39b4298b5071 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Wed, 13 Jan 2021 21:41:20 +0100 Subject: ifconfig: T2653: return empty string when there is no interface description After switching to iproute2 in commit 92f36735 ("ifconfig: T2653: use iproute2 commands for alias, mac and mtu set()/get()" it is necessary to return an empty string as iproute2 returns None. (cherry picked from commit ea1be032e98fd1634e71d3c2d61b3e93bff841de) --- python/vyos/ifconfig/interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py index ba0a8adc0..1561d340e 100644 --- a/python/vyos/ifconfig/interface.py +++ b/python/vyos/ifconfig/interface.py @@ -81,7 +81,7 @@ class Interface(Control): }, 'alias': { 'shellcmd': 'ip -json -detail link list dev {ifname}', - 'format': lambda j: jmespath.search('[*].ifalias | [0]', json.loads(j)), + 'format': lambda j: jmespath.search('[*].ifalias | [0]', json.loads(j)) or '', }, 'mac': { 'shellcmd': 'ip -json -detail link list dev {ifname}', -- cgit v1.2.3