Files
buryan-infra/ops/scripts/fix_rch.py
T

28 lines
914 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""RCH* — VCS-инфраструктура, а не unknown."""
import os
import yaml
paths = [
"/opt/work-hub/compat/catalog.yaml",
"/root/buryan-infra/ops/combine/catalog-p0-2026-11-18.yaml",
]
names = {"RCH40 E2", "RCH80", "RCH240"}
for p in paths:
if not os.path.exists(p):
continue
d = yaml.safe_load(open(p, encoding="utf-8"))
n = 0
for x in d.get("devices") or []:
if (x.get("name") or x.get("model")) in names:
x["domain"] = "vcs"
x["group"] = "E_infra"
x["line"] = "infrastructure.switch"
x["role"] = "sharing_hub"
x["solution_class"] = "vcs.accessory"
x["analog_group"] = "vcs.accessory"
x["form_factor"] = "accessory"
n += 1
yaml.safe_dump(d, open(p, "w", encoding="utf-8"), allow_unicode=True, sort_keys=False)
print(p, "fixed", n)