statd: add contact + location to ietf-system:system operational

The contact and location leaves were absent from the operational
datastore.  Fetch each leaf from the running ds tool and inject
into ietf-system:system.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2026-06-12 13:47:18 +02:00
parent 68dfec210c
commit ec7f9ced74
+9 -1
View File
@@ -257,9 +257,16 @@ def add_software(out):
insert(out, "infix-system:software", software)
def add_hostname(out):
hostname = HOST.run(tuple(["hostname"]))
hostname = HOST.run(tuple(["hostname"]))
out["hostname"] = hostname.strip()
def add_contact_location(out):
for name in ("contact", "location"):
data = HOST.run_json(("copy", "running", "-x", f"/system/{name}"), {})
val = data.get("ietf-system:system", {}).get(name)
if val:
out[name] = val
def add_timezone(out):
path = HOST.run(tuple("realpath /etc/localtime".split()), "")
timezone = None
@@ -448,6 +455,7 @@ def operational():
out_state = out["ietf-system:system-state"]
out_system = out["ietf-system:system"]
add_hostname(out_system)
add_contact_location(out_system)
add_users(out_system)
add_timezone(out_system)
add_software(out_state)