summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-08-01 10:56:40 +0200
committerGitHub <noreply@github.com>2022-08-01 10:56:40 +0200
commit537fc205933b99d291a4e696cee392785ca964bc (patch)
tree52ee3d4dbb80563aae85f1450a76bf0fc94eb2ee
parent225b1d3ef2e211c03814cb823b857c66084f7978 (diff)
parentab84f1f3757bb82c3ddf95143c014cdb3d997977 (diff)
downloadvyos-1x-537fc205933b99d291a4e696cee392785ca964bc.tar.gz
vyos-1x-537fc205933b99d291a4e696cee392785ca964bc.zip
Merge pull request #1451 from sever-sever/T4562
vrf: T4562: Check VRF if it has not been configured
-rwxr-xr-xsrc/op_mode/vrf.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/op_mode/vrf.py b/src/op_mode/vrf.py
index f86516786..e3d944d90 100755
--- a/src/op_mode/vrf.py
+++ b/src/op_mode/vrf.py
@@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import json
+import jmespath
import sys
import typing
@@ -76,6 +77,8 @@ def _get_formatted_output(raw_data):
def show(raw: bool, name: typing.Optional[str]):
vrf_data = _get_raw_data(name=name)
+ if not jmespath.search('[*].ifname', vrf_data):
+ return "VRF is not configured"
if raw:
return vrf_data
else: