PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /proc/self/root/opt/tier1adv/bin/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //proc/self/root/opt/tier1adv/bin/validate_zone

#!/opt/imh-python/bin/python3
import argparse
import sys
from pathlib import Path
import subprocess
from rads.color import green

sys.path.insert(0, '/opt/support/lib')
from arg_types import valid_domain
from output import err_exit


def get_args() -> str:
    """Parse domain from command arguments"""
    parser = argparse.ArgumentParser()
    parser.add_argument('domain', type=valid_domain, help='domain to check')
    return parser.parse_args().domain


def main():
    domain = get_args()
    zone_file = Path('/var/named', f"{domain}.db")
    if zone_file.is_file():
        print(green(f'Zone File exists at {zone_file}'))
    else:
        err_exit(f'Zone file does not exist at {zone_file}')
    try:
        ret_code = subprocess.call(['named-checkzone', domain, str(zone_file)])
    except FileNotFoundError as exc:  # named-checkzone is missing
        err_exit(str(exc))
    if ret_code:  # non-zero return code
        err_exit(f'Failed to validate the zone file at {zone_file}')
    print(green(f'Successfully validated the zone file at {zone_file}'))


if __name__ == "__main__":
    main()