diff --git a/src/helpers.py b/src/helpers.py index 26a1114..fdda722 100644 --- a/src/helpers.py +++ b/src/helpers.py @@ -70,15 +70,6 @@ def extract_domain_from_path(path: str) -> str|None: return None -def validate_zone(zone_name, content) -> bool: - try: - dns.zone.from_text(content, zone_name, relativize=False) - logging.info(f"Zone {zone_name} parsed successfully") - return True - except Exception as e: - logging.error(f"Parse failed for zone {zone_name}") - return False - def export_single_zone(trigger_path: str) -> list[Path]: logging.info(f"Starting export of single zone for trigger path {trigger_path})") ensure_git_repo() diff --git a/src/technitium.py b/src/technitium.py index 70a7c0e..c6bf052 100644 --- a/src/technitium.py +++ b/src/technitium.py @@ -2,10 +2,18 @@ import logging import requests from config import * -from helpers import validate_zone session = requests.Session() +def validate_zone(zone_name, content) -> bool: + try: + dns.zone.from_text(content, zone_name, relativize=False) + logging.info(f"Zone {zone_name} parsed successfully") + return True + except Exception as e: + logging.error(f"Parse failed for zone {zone_name}") + return False + def list_zones() -> list[dict]: url = f"{TECHNITIUM_API_BASE.rstrip('/')}{LIST_ZONES_ENDPOINT}?token={API_TOKEN}" logging.debug(f"Listing zones from {url}")