Hide the passwords
This commit is contained in:
@@ -142,6 +142,13 @@ def restart_manager_container():
|
|||||||
}
|
}
|
||||||
except subprocess.CalledProcessError as exc:
|
except subprocess.CalledProcessError as exc:
|
||||||
error = (exc.stderr or exc.stdout or str(exc)).strip()
|
error = (exc.stderr or exc.stdout or str(exc)).strip()
|
||||||
|
if any(marker in error.lower() for marker in ("no such container", "no such object", "not found")):
|
||||||
|
return {
|
||||||
|
"attempted": False,
|
||||||
|
"ok": True,
|
||||||
|
"reason": "manager_not_running",
|
||||||
|
"error": error,
|
||||||
|
}
|
||||||
return {"attempted": True, "ok": False, "error": error}
|
return {"attempted": True, "ok": False, "error": error}
|
||||||
|
|
||||||
return {"attempted": True, "ok": True, "output": result.stdout.strip()}
|
return {"attempted": True, "ok": True, "output": result.stdout.strip()}
|
||||||
@@ -253,6 +260,7 @@ class ConfiguratorHandler(SimpleHTTPRequestHandler):
|
|||||||
content_length = int(self.headers.get("Content-Length", "0"))
|
content_length = int(self.headers.get("Content-Length", "0"))
|
||||||
payload = self.rfile.read(content_length)
|
payload = self.rfile.read(content_length)
|
||||||
raw = json.loads(payload.decode("utf-8"))
|
raw = json.loads(payload.decode("utf-8"))
|
||||||
|
config_existed = CONFIG_PATH.exists()
|
||||||
previous_compact = read_compact_config_from_disk()
|
previous_compact = read_compact_config_from_disk()
|
||||||
normalized = normalize_config(raw)
|
normalized = normalize_config(raw)
|
||||||
compact = compact_config(raw)
|
compact = compact_config(raw)
|
||||||
@@ -265,9 +273,12 @@ class ConfiguratorHandler(SimpleHTTPRequestHandler):
|
|||||||
self._send_json({"ok": False, "error": f"Invalid JSON: {exc}"}, status=HTTPStatus.BAD_REQUEST)
|
self._send_json({"ok": False, "error": f"Invalid JSON: {exc}"}, status=HTTPStatus.BAD_REQUEST)
|
||||||
return
|
return
|
||||||
|
|
||||||
manager_restart = {"attempted": False, "ok": True}
|
manager_restart = {"attempted": False, "ok": True, "reason": "unchanged"}
|
||||||
if compact != previous_compact:
|
if compact != previous_compact:
|
||||||
|
if config_existed:
|
||||||
manager_restart = restart_manager_container()
|
manager_restart = restart_manager_container()
|
||||||
|
else:
|
||||||
|
manager_restart = {"attempted": False, "ok": True, "reason": "first_install"}
|
||||||
|
|
||||||
self._send_json(
|
self._send_json(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -341,6 +341,18 @@
|
|||||||
function managerRestartMessage(result, savedMessage) {
|
function managerRestartMessage(result, savedMessage) {
|
||||||
const restart = result.manager_restart;
|
const restart = result.manager_restart;
|
||||||
if (!restart?.attempted) {
|
if (!restart?.attempted) {
|
||||||
|
if (restart?.reason === "first_install") {
|
||||||
|
return {
|
||||||
|
message: `${savedMessage} Prima installazione: manager fis_manager non ancora avviato. Esegui ./install.sh quando sei pronto.`,
|
||||||
|
kind: "ok"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (restart?.reason === "manager_not_running") {
|
||||||
|
return {
|
||||||
|
message: `${savedMessage} Manager fis_manager non ancora avviato. Esegui ./install.sh quando sei pronto.`,
|
||||||
|
kind: "ok"
|
||||||
|
};
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
message: `${savedMessage} Nessuna modifica rilevata: restart non necessario.`,
|
message: `${savedMessage} Nessuna modifica rilevata: restart non necessario.`,
|
||||||
kind: "ok"
|
kind: "ok"
|
||||||
|
|||||||
Reference in New Issue
Block a user