Compare commits

...
Author SHA1 Message Date
Mattias Walström 52735154ad statd: yanger: Do not fail if rauc or /run/system.json is not found
This to be able to run statd outside infix.
2025-04-13 15:28:13 +02:00
2 changed files with 27 additions and 16 deletions
+9 -4
View File
@@ -78,13 +78,18 @@ def usb_port_components(systemjson):
def operational():
systemjson = HOST.read_json("/run/system.json")
try:
systemjson = HOST.read_json("/run/system.json")
vpd_components(systemjson)
usb_port_components(systemjson)
components = vpd_component + usb_port_components + []
except:
components = []
return {
"ietf-hardware:hardware": {
"component":
vpd_components(systemjson) +
usb_port_components(systemjson) +
[],
components
},
}
+18 -12
View File
@@ -171,19 +171,25 @@ def add_software(out):
except subprocess.CalledProcessError:
pass # Maybe an upgrade i progress, then rauc does not respond
installer_status = HOST.run_json(["rauc-installation-status"])
installer = {}
if installer_status.get("operation"):
installer["operation"] = installer_status["operation"]
if "progress" in installer_status:
progress = {}
except FileNotFoundError:
pass
if installer_status["progress"].get("percentage"):
progress["percentage"] = int(installer_status["progress"]["percentage"])
if installer_status["progress"].get("message"):
progress["message"] = installer_status["progress"]["message"]
installer["progress"] = progress
software["installer"] = installer
installer = {}
try:
installer_status = HOST.run_json(["rauc-installation-status"])
if installer_status.get("operation"):
installer["operation"] = installer_status["operation"]
if "progress" in installer_status:
progress = {}
if installer_status["progress"].get("percentage"):
progress["percentage"] = int(installer_status["progress"]["percentage"])
if installer_status["progress"].get("message"):
progress["message"] = installer_status["progress"]["message"]
installer["progress"] = progress
software["installer"] = installer
except FileNotFoundError:
pass
insert(out, "infix-system:software", software)