works
This commit is contained in:
@@ -396,42 +396,6 @@ def server_audit():
|
||||
return {"raw_output": output}
|
||||
|
||||
|
||||
@app.get("/system/info", dependencies=[Depends(verify_api_key)])
|
||||
def get_system_info():
|
||||
try:
|
||||
alpine_version = None
|
||||
last_update = None
|
||||
bump_dates = execute_db(
|
||||
"SELECT MAX(bump) AS latest_bump FROM containers", fetch=True
|
||||
)[0]["latest_bump"]
|
||||
if os.path.exists("/4server/data/update"):
|
||||
with open("/4server/data/update") as f:
|
||||
last_update = f.read().strip()
|
||||
if os.path.exists("/etc/alpine-release"):
|
||||
with open("/etc/alpine-release") as f:
|
||||
alpine_version = f.read().strip()
|
||||
mem = psutil.virtual_memory()
|
||||
disk = psutil.disk_usage("/")
|
||||
cpu_count = psutil.cpu_count(logical=True)
|
||||
return {
|
||||
"alpine_version": alpine_version,
|
||||
"last_update": last_update,
|
||||
"latest_bump": bump_dates,
|
||||
"version": VERSION,
|
||||
"resources": {
|
||||
"memory": {
|
||||
"total": mem.total,
|
||||
"available": mem.available,
|
||||
"used": mem.used,
|
||||
},
|
||||
"disk": {"total": disk.total, "used": disk.used, "free": disk.free},
|
||||
"cpu_count": cpu_count,
|
||||
},
|
||||
}
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
|
||||
|
||||
@app.post("/system/pull", dependencies=[Depends(verify_api_key)])
|
||||
def pull_all_images():
|
||||
return {"message": run_command([f"{BIN_PATH}/pullAllContainers"])}
|
||||
|
||||
Reference in New Issue
Block a user