From 7380bf1216399f905fe85ff26eaa0272b9f6dfe0 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Thu, 23 Mar 2023 08:31:28 -0500 Subject: op-mode: T5107: raise error instead of calling exit --- src/op_mode/dns.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/op_mode/dns.py b/src/op_mode/dns.py index a0e47d7ad..f8863c530 100755 --- a/src/op_mode/dns.py +++ b/src/op_mode/dns.py @@ -17,7 +17,6 @@ import sys -from sys import exit from tabulate import tabulate from vyos.configquery import ConfigTreeQuery @@ -75,8 +74,7 @@ def show_forwarding_statistics(raw: bool): config = ConfigTreeQuery() if not config.exists('service dns forwarding'): - print("DNS forwarding is not configured") - exit(0) + raise vyos.opmode.UnconfiguredSubsystem('DNS forwarding is not configured') dns_data = _get_raw_forwarding_statistics() if raw: -- cgit v1.2.3