diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-04-08 20:35:06 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-04-08 20:36:30 +0200 |
commit | c497007369bf53aa99399a9ede4b52fc2d50b563 (patch) | |
tree | fe2ae86d8517f2dca48690153d7562662bfecafd /src | |
parent | 53754fcbbf926eaa353e1cd5f12ad1faed668ac1 (diff) | |
download | vyos-1x-c497007369bf53aa99399a9ede4b52fc2d50b563.tar.gz vyos-1x-c497007369bf53aa99399a9ede4b52fc2d50b563.zip |
op-mode: dns: forwarding: cleanup
Diffstat (limited to 'src')
-rwxr-xr-x | src/op_mode/dns_forwarding_reset.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/op_mode/dns_forwarding_reset.py b/src/op_mode/dns_forwarding_reset.py index 93c2444b9..dad78d7e8 100755 --- a/src/op_mode/dns_forwarding_reset.py +++ b/src/op_mode/dns_forwarding_reset.py @@ -21,13 +21,12 @@ import os -import sys import argparse -import vyos.config +from sys import exit +from vyos.config import Config from vyos.util import run - parser = argparse.ArgumentParser() parser.add_argument("-a", "--all", action="store_true", help="Reset all cache") parser.add_argument("domain", type=str, nargs="?", help="Domain to reset cache entries for") @@ -36,16 +35,18 @@ if __name__ == '__main__': args = parser.parse_args() # Do nothing if service is not configured - c = vyos.config.Config() - if not c.exists_effective('service dns forwarding'): + c = Config() + if not c.exists_effective(['service', 'dns', 'forwarding']): print("DNS forwarding is not configured") - sys.exit(0) + exit(0) if args.all: run("rec_control wipe-cache \'.$\'") - sys.exit(1) + exit(0) + elif args.domain: run("rec_control wipe-cache \'{0}$\'".format(args.domain)) + else: parser.print_help() - sys.exit(1) + exit(1) |