{
  "schema_version": 1,
  "channel": "homelab-runtime",
  "command_id": "CLUSTER-REFERENCE-CORE-INVENTORY-161",
  "status": "FAIL",
  "rc": 1,
  "host": "pve01",
  "mode": "change",
  "component": "reference-update",
  "started_at_utc": "2026-07-22T08:47:05Z",
  "finished_at_utc": "2026-07-22T08:47:05Z",
  "reference_register_checked": true,
  "reference_sha256": "5763f2f8edc75fcf6f3951f8c95896d1cc112ceccb6cf5b64a383f540a4deb8e",
  "error_register_checked": true,
  "error_register_sha256": "08b3a769b8e38eaa1acec915352fb328180d70caa7ff6cd9d1ec0da426262752",
  "command_sha256": "9f9a4398c63fdddddd53865e69da2f8af6ff9c9c69398ec28d530d5449d7296e",
  "duplicate_failed_command_blocked": false,
  "block_reason": null,
  "execution_started": true,
  "changes_made": true,
  "sanitized": true,
  "secrets_included": false,
  "private_addresses_included": false,
  "raw_evidence_retained_locally": true,
  "raw_evidence_sha256": "45b8d84f9e819bf717f6a1d7cf029f793f6f32c545ac2a017f9af091da4c2152",
  "sanitized_output_sha256": "45b8d84f9e819bf717f6a1d7cf029f793f6f32c545ac2a017f9af091da4c2152",
  "output_truncated_in_json": false,
  "full_sanitized_output_url": "https://git.gram1.ru/.well-known/homelab-runtime/latest.txt",
  "output": "  File \"<string>\", line 1\n    import datetime,json,os,pathlib,re,shutil,socket,subprocess,urllib.request;root=pathlib.Path(\"/etc/homelab/reference\");assert (root/\"manifest.json\").is_file() and (root/\"state/current.json\").is_file();u=\"https://git.gram1.ru/homelab-admin/homelab-public-context/raw/commit/321a330f9e5c8696e6e8bf1e147ce5386f3de352/runtime/history/CLUSTER-REFERENCE-CORE-INVENTORY-156.json\";prev=json.load(urllib.request.urlopen(urllib.request.Request(u,headers={\"User-Agent\":\"homelab-reference/3\"}),timeout=60));assert prev.get(\"command_id\")==\"CLUSTER-REFERENCE-CORE-INVENTORY-156\" and prev.get(\"status\")==\"FAIL\" and int(prev.get(\"rc\"))==1 and \"SyntaxError\" in str(prev.get(\"output\",\"\"));manifest=json.loads((root/\"manifest.json\").read_text(encoding=\"utf-8\"));now=datetime.datetime.now(datetime.timezone.utc).replace(microsecond=0);now_s=now.isoformat();sections=[\"cluster\",\"nodes\",\".json\").read_text(encoding=\"utf-8\"));now=datetime.datetime.now(datetimeguests\",\"containers\",\"storage\",\"networks\",\"dns\"];snap=root/\"snapshots\"/(\"core-\"+now.strftime(\"%Y%m%dT%H%M%SZ\"));snap.mkdir(parents=True,exist_ok=False);[(shutil.copy2(root/\"observed\"/(s+\".json\"),snap/(s+\".json\"))) for s in sections if (root/\"observed\"/(s+\".json\")).is_file()];out=lambda a:subprocess.check_output(a,text=True,stderr=subprocess.STDOUT,timeout=90);txt=lambda a:(lambda r:r.stdout+r.stderr)(subprocess.run(a,stdout=subprocess.PIPE,stderr=subprocess.PIPE,text=True,timeout=90,check=False));nodes=json.loads(out([\"pvesh\",\"get\",\"/nodes\",\"--output-format\",\"json\"]));guests=json.loads(out([\"pvesh\",\"get\",\"/cluster/resources\",\"--type\",\"vm\",\"--output-format\",\"json\"]));storage=json.loads(out([\"pvesh\",\"get\",\"/storage\",\"--output-format\",\"json\"]));addresses=json.loads(out([\"ip\",\"-j\",\"address\"]));routes=json.loads(out([\"ip\",\"-j\",\"route\",\"show\",\"table\",\"all\"]));slug=lambda v:re.sub(\"[^a-z0-9._-]+\",\"-\",str(v).lower()).strip(\"-\") or \"unknown\";fresh=lambda s:(now+datetime.timedelta(seconds=int(manifest.get(\"freshness_seconds\",{}).get(s,3600)))).isoformat();decorate=lambda s,x:{**x,\"observed_at\":now_s,\"fresh_until\":fresh(s),\"source\":\"core-internal-collector\"};resolv=pathlib.Path(\"/etc/resolv.conf\");records={\"cluster\":[decorate(\"cluster\",{\"id\":\"cluster-homelab\",\"hostname\":socket.gethostname(),\"kernel\":os.uname().release,\"pve_version\":txt([\"pveversion\",\"--verbose\"]),\"quorum_status\":txt([\"pvecm\",\"status\"])})],\"nodes\":[decorate(\"nodes\",{**x,\"id\":\"node-\"+slug(x.get(\"node\") or x.get(\"id\"))}) for x in nodes],\"guests\":[decorate(\"guests\",{\"id\":\"guest-\"+slug(x.get(\"vmid\")),\"vmid\":x.get(\"vmid\"),\"name\":x.get(\"name\"),\"type\":x.get(\"type\"),\"node\":x.get(\"node\"),\"status\":x.get(\"status\"),\"template\":x.get(\"template\"),\"uptime\":x.get(\"uptime\"),\"cpus\":x.get(\"maxcpu\"),\"memory_bytes\":x.get(\"maxmem\"),\"disk_bytes\":x.get(\"maxdisk\"),\"tags\":x.get(\"tags\")}) for x in guests],\"containers\":[decorate(\"containers\",{\"id\":\"container-\"+slug(x.get(\"vmid\")),\"vmid\":x.get(\"vmid\"),\"name\":x.get(\"name\"),\"node\":x.get(\"node\"),\"status\":x.get(\"status\"),\"uptime\":x.get(\"uptime\"),\"cpus\":x.get(\"maxcpu\"),\"memory_bytes\":x.get(\"maxmem\"),\"disk_bytes\":x.get(\"maxdisk\"),\"tags\":x.get(\"tags\")}) for x in guests if x.get(\"type\")==\"lxc\"],\"storage\":[decorate(\"storage\",{**x,\"id\":\"storage-\"+slug(x.get(\"storage\") or x.get(\"id\"))}) for x in storage],\"networks\":[decorate(\"networks\",{\"id\":\"network-state-\"+slug(socket.gethostname()),\"hostname\":socket.gethostname(),\"interfaces\":addresses,\"routes\":routes})],\"dns\":[decorate(\"dns\",{\"id\":\"resolver-state-\"+slug(socket.gethostname()),\"hostname\":socket.gethostname(),\"resolv_conf\":resolv.read_text(encoding=\"utf-8\",errors=\"replace\").splitlines() if resolv.is_file() else []})]};[(root/\"observed\"/(s+\".json\")).write_text(json.dumps({\"schema_version\":2,\"section\":s,\"layer\":\"observed\",\"updated_at\":now_s,\"source\":\"core-internal-collector\",\"records\":v},ensure_ascii=False,indent=2)+\"\\n\",encoding=\"utf-8\") for s,v in records.items()];state=json.loads((root/\"state/current.json\").read_text(encoding=\"utf-8\"));state.update({\"schema_version\":2,\"status\":\"CORE_INTERNAL_INVENTORY_READY\",\"updated_at\":now_s,\"last_snapshot\":str(snap),\"core_internal_counts\":{s:len(v) for s,v in records.items()},\"previous_command_id\":\"CLUSTER-REFERENCE-CORE-INVENTORY-156\",\"previous_immutable_commit\":\"321a330f9e5c8696e6e8bf1e147ce5386f3de352\"});(root/\"state/current.json\").write_text(json.dumps(state,ensure_ascii=False,indent=2)+\"\\n\",encoding=\"utf-8\");[json.loads(p.read_text(encoding=\"utf-8\")) for p in root.rglob(\"*.json\")];[os.chmod(p,0o750 if p.is_dir() else 0o640) for p in [root,*root.rglob(\"*\")]];print(\"PREVIOUS_FAILURE=CONFIRMED\");print(\"REFERENCE_SNAPSHOT=\"+str(snap));print(\"CORE_INTERNAL_SECTIONS=\"+str(len(records)));print(\"CORE_INTERNAL_RECORDS=\"+str(sum(len(v) for v in records.values())));print(\"REFERENCE_STATUS=CORE_INTERNAL_INVENTORY_READY);print(\"CLUSTER_REFERENCE_CORE_INVENTORY=COMPLETE\")\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ^\nSyntaxError: closing parenthesis ')' does not match opening parenthesis '['\n"
}
