From 3db6797e532084088537779223397a633688c843 Mon Sep 17 00:00:00 2001 From: Adis Durakovic Date: Wed, 6 Nov 2024 14:56:24 +0100 Subject: [PATCH] initial commit --- Dockerfile | 4 ++-- monitor.py | 8 -------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6bdd6c4..1435feb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM python:3 -RUN apt update && apt install -y docker.io libglib2.0-dev libdbus-1-dev ca-certificates curl avahi-daemon +RUN apt update && apt install -y docker.io -RUN pip install docker dbus-python +RUN pip install docker COPY ./monitor.py /monitor.py diff --git a/monitor.py b/monitor.py index 76ae812..265e991 100644 --- a/monitor.py +++ b/monitor.py @@ -149,16 +149,8 @@ def update_hosts_file(container_ips): os.makedirs(os.path.dirname(HOSTS_FILE), exist_ok=True) try: - # Write to temporary file first - temp_file = f"{HOSTS_FILE}.tmp" with open(HOSTS_FILE, 'w') as f: f.write(hosts_content) - - # Check file permissions - # os.chmod(temp_file, 0o644) - - # Atomic replace - # os.rename(temp_file, HOSTS_FILE) logging.info(f"Successfully updated {HOSTS_FILE}") except Exception as e: logging.error(f"Error writing hosts file: {e}")