fix: Add dig to Docker, fix admin sync endpoints
- Added dnsutils (dig) to backend Dockerfile for DNS zone transfers - Fixed admin zone sync endpoints with correct imports - AsyncSessionLocal instead of async_session_maker
This commit is contained in:
@ -12,8 +12,10 @@ RUN groupadd -r pounce && useradd -r -g pounce pounce
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install system dependencies
|
# Install system dependencies
|
||||||
|
# dnsutils provides 'dig' for DNS zone transfers (AXFR)
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
curl \
|
curl \
|
||||||
|
dnsutils \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install Python dependencies
|
# Install Python dependencies
|
||||||
|
|||||||
@ -1743,11 +1743,12 @@ async def trigger_switch_sync(
|
|||||||
from app.services.zone_file import ZoneFileService
|
from app.services.zone_file import ZoneFileService
|
||||||
|
|
||||||
async def run_sync():
|
async def run_sync():
|
||||||
zf = ZoneFileService()
|
from app.database import AsyncSessionLocal
|
||||||
from app.database import async_session_maker
|
async with AsyncSessionLocal() as session:
|
||||||
async with async_session_maker() as session:
|
zf = ZoneFileService()
|
||||||
result = await zf.sync_all_zones(session)
|
for tld in ["ch", "li"]:
|
||||||
return result
|
await zf.run_daily_sync(session, tld)
|
||||||
|
return {"status": "complete"}
|
||||||
|
|
||||||
background_tasks.add_task(run_sync)
|
background_tasks.add_task(run_sync)
|
||||||
|
|
||||||
@ -1770,9 +1771,9 @@ async def trigger_czds_sync(
|
|||||||
from app.services.czds_client import CZDSClient
|
from app.services.czds_client import CZDSClient
|
||||||
|
|
||||||
async def run_sync():
|
async def run_sync():
|
||||||
client = CZDSClient()
|
from app.database import AsyncSessionLocal
|
||||||
from app.database import async_session_maker
|
async with AsyncSessionLocal() as session:
|
||||||
async with async_session_maker() as session:
|
client = CZDSClient()
|
||||||
result = await client.sync_all_zones(session)
|
result = await client.sync_all_zones(session)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user