[PRISM] Strict vendor room: один вендор, без смешивания аксессуаров; профили веток
This commit is contained in:
1 parent
6b690d717b
commit
e1c0f31f22
5 files changed
+316
-211
No files matched your search
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Применить курированные профили других вендоров к веткам и stage."""
|
||||
import glob
|
||||
import os
|
||||
import shutil
|
||||
import time
|
||||
import yaml
|
||||
|
||||
PROFILES = "/root/buryan-infra/ops/combine/vendors-other-models-2026-11-18.yaml"
|
||||
prof = yaml.safe_load(open(PROFILES, encoding="utf-8"))
|
||||
pmap = {(x["vendor"], x["model"]): x for x in prof.get("devices") or []}
|
||||
paths = [os.path.join("/opt/work-hub/compat", "catalog.yaml")] + \
|
||||
sorted(glob.glob("/opt/work-hub/compat/catalog-*.yaml")) + \
|
||||
["/root/buryan-infra/ops/combine/catalog-p0-2026-11-18.yaml"]
|
||||
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 []:
|
||||
q = pmap.get((x.get("vendor"), x.get("model")))
|
||||
if not q:
|
||||
continue
|
||||
for k in ("role", "group", "line", "solution_class", "form_factor",
|
||||
"native_vcs", "deployment", "components", "sales_scope"):
|
||||
if k in q:
|
||||
x[k] = q[k]
|
||||
if not q.get("solution_class"):
|
||||
role = q.get("role") or x.get("role")
|
||||
grp = q.get("group") or x.get("group")
|
||||
cls = {"camera": "vcs.camera.usb", "pc": "vcs.terminal.pc",
|
||||
"audio": "vcs.audio", "speaker": "vcs.audio",
|
||||
"touch": "vcs.control.touch", "display": "passive.display",
|
||||
"mount": "passive.mount", "codec": "vcs.terminal.room",
|
||||
"kit": "vcs.byod.kit", "sharing_hub": "vcs.sharing"}.get(role)
|
||||
if role == "codec" and grp == "B_video_bars":
|
||||
cls = "vcs.bar.room"
|
||||
if cls:
|
||||
x["solution_class"] = cls
|
||||
x["domain"] = "vcs"
|
||||
x["analog_group"] = x.get("solution_class")
|
||||
n += 1
|
||||
if n:
|
||||
shutil.copy2(p, p + ".bak-prof-" + time.strftime("%Y%m%d-%H%M%S"))
|
||||
yaml.safe_dump(d, open(p, "w", encoding="utf-8"), allow_unicode=True, sort_keys=False)
|
||||
print(os.path.basename(p), "profiles", n)
|
||||
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Нормализовать domain=vcs у не-Yealink веток (кроме телефонии)."""
|
||||
import glob
|
||||
import os
|
||||
import shutil
|
||||
import time
|
||||
import yaml
|
||||
|
||||
BASE = "/opt/work-hub/compat"
|
||||
paths = [os.path.join(BASE, "catalog.yaml")] + sorted(glob.glob(os.path.join(BASE, "catalog-*.yaml")))
|
||||
paths.append("/root/buryan-infra/ops/combine/catalog-p0-2026-11-18.yaml")
|
||||
for p in paths:
|
||||
if not os.path.exists(p):
|
||||
continue
|
||||
d = yaml.safe_load(open(p, encoding="utf-8"))
|
||||
devs = d.get("devices") or []
|
||||
n = 0
|
||||
for x in devs:
|
||||
if x.get("vendor") == "yealink":
|
||||
continue
|
||||
if x.get("domain") in ("", "unknown", None) and x.get("role") not in ("phone", "headset"):
|
||||
x["domain"] = "vcs"
|
||||
n += 1
|
||||
if n:
|
||||
shutil.copy2(p, p + ".bak-domain-" + time.strftime("%Y%m%d-%H%M%S"))
|
||||
yaml.safe_dump(d, open(p, "w", encoding="utf-8"), allow_unicode=True, sort_keys=False)
|
||||
print(os.path.basename(p), "fixed", n)
|
||||
Reference in new issue
Block a user