aliases = get_aliases()
return aliases or []
+ except HTTPException:
+ raise
+
except Exception as err:
logger.exception("Error getting list alias %s", str(err).strip())
raise HTTPException(
)
return alias
+ except HTTPException:
+ raise
+
except Exception as err:
logger.exception("Error adding alias %s: %s", alias_id, str(err).strip())
took_ms = (time.monotonic_ns() - start_ns) / 1_000_000
},
)
- except HTTPException as httpe:
- raise httpe
+ except HTTPException:
+ raise
except Exception as err:
logger.exception("Error adding alias: %s", str(err).strip())
},
)
+ except HTTPException:
+ raise
+
except Exception as err:
logger.exception("Error updating alias %s: %s", alias_id, str(err).strip())
took_ms = (time.monotonic_ns() - start_ns) / 1_000_000
},
)
+ except HTTPException:
+ raise
+
except Exception as err:
logger.exception("Error deleting alias %s: %s", alias_id, str(err).strip())
took_ms = (time.monotonic_ns() - start_ns) / 1_000_000
hosts = get_hosts()
# Backup Hosts DB
- path = settings.DATA_PATH + "/hosts.json"
+ path = os.path.join(settings.DATA_PATH, "hosts.json")
with open(path, "w", encoding="utf-8") as f:
for h in hosts:
f.write(json.dumps(h, ensure_ascii=False) + "\n")
aliases = get_aliases()
# Backup Aliases DB
- path = settings.DATA_PATH + "/aliases.json"
+ path = os.path.join(settings.DATA_PATH, "aliases.json")
with open(path, "w", encoding="utf-8") as f:
for a in aliases:
f.write(json.dumps(a, ensure_ascii=False) + "\n")
200: {"description": "Backup executed successfully"},
500: {"description": "Internal server error"},
})
-async def api_dns_reload(request: Request):
+async def api_backup(request: Request):
# Inizializzazioni
start_ns = time.monotonic_ns()
},
)
+ except HTTPException:
+ raise
+
except Exception as err:
took_ms = (time.monotonic_ns() - start_ns) / 1_000_000
logger.exception("Error executing backup: %s", str(err).strip())
},
)
+ except HTTPException:
+ raise
+
except Exception as err:
logger.exception("Error reloading DHCP: %s", str(err).strip())
took_ms = (time.monotonic_ns() - start_ns) / 1_000_000
},
)
+ except HTTPException:
+ raise
+
except Exception as err:
logger.exception("Error reloading DNS: %s", str(err).strip())
took_ms = (time.monotonic_ns() - start_ns) / 1_000_000
hosts = get_hosts()
return hosts or []
+ except HTTPException:
+ raise
+
except Exception as err:
logger.exception("Error getting list host %s", str(err).strip())
raise HTTPException(
)
return host
+ except HTTPException:
+ raise
+
except Exception as err:
logger.exception("Error adding host %s: %s", host_id, str(err).strip())
took_ms = (time.monotonic_ns() - start_ns) / 1_000_000
},
)
- except HTTPException as httpe:
- raise httpe
+ except HTTPException:
+ raise
except Exception as err:
logger.exception("Error adding host: %s", str(err).strip())
},
)
+ except HTTPException:
+ raise
+
except Exception as err:
logger.exception("Error updating host %s: %s", host_id, str(err).strip())
took_ms = (time.monotonic_ns() - start_ns) / 1_000_000
},
)
+ except HTTPException:
+ raise
+
except Exception as err:
logger.exception("Error deleting host %s: %s", host_id, str(err).strip())
took_ms = (time.monotonic_ns() - start_ns) / 1_000_000