diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/op_mode/show_dhcpv6.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/op_mode/show_dhcpv6.py b/src/op_mode/show_dhcpv6.py index 8879a45c5..bf73b92ea 100755 --- a/src/op_mode/show_dhcpv6.py +++ b/src/op_mode/show_dhcpv6.py @@ -18,14 +18,12 @@ import json import argparse import ipaddress - import tabulate +import sys -import vyos.config - +from vyos.config import Config from isc_dhcp_leases import Lease, IscDhcpLeases - lease_file = "/config/dhcpdv6.leases" def get_lease_data(lease): @@ -73,6 +71,12 @@ if __name__ == '__main__': args = parser.parse_args() + # Do nothing if service is not configured + c = Config() + if not c.exists_effective('service dhcpv6-server'): + print("DHCPv6 service is not configured") + sys.exit(0) + if args.leases: leases = get_leases(lease_file, state='active') show_leases(leases) |