Update app
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
dvirlabs 2026-04-22 20:48:19 +03:00
parent da13db921f
commit 618a139847

24
app.py
View File

@ -135,12 +135,30 @@ def health():
def ready():
"""GET /ready - Kubernetes readiness probe"""
try:
# Try to access the status file
if os.path.exists(STATUS_FILE):
# Check if data directory is writable
data_dir = os.path.dirname(STATUS_FILE)
if not os.path.exists(data_dir):
os.makedirs(data_dir, exist_ok=True)
# Try to read or create status file
if not os.path.exists(STATUS_FILE):
# File doesn't exist yet, try to create it
default_status = {
"repo": "unknown",
"server": "unknown",
"sync_status": "UNKNOWN",
"drift_count": 0,
"files": [],
"last_check": ""
}
save_status(default_status)
# Verify we can read it
status = load_status()
if isinstance(status, dict):
return jsonify({"status": "ready"}), 200
return jsonify({"status": "not_ready", "reason": "status file not accessible"}), 503
return jsonify({"status": "not_ready", "reason": "invalid status data"}), 503
except Exception as e:
logger.error(f"Readiness check failed: {e}")
return jsonify({"status": "not_ready", "error": str(e)}), 503