|
@@ -108,6 +108,8 @@ struct
|
|
in Date.toTime tsdate
|
|
in Date.toTime tsdate
|
|
end
|
|
end
|
|
|
|
|
|
|
|
+ fun get_version obj = JU.asInt (JU.lookupField obj "version")
|
|
|
|
+
|
|
fun get_timestamp obj =
|
|
fun get_timestamp obj =
|
|
let val tsstring = JU.asString (JU.lookupField obj "timestamp")
|
|
let val tsstring = JU.asString (JU.lookupField obj "timestamp")
|
|
val tstime = timestring2time tsstring
|
|
val tstime = timestring2time tsstring
|
|
@@ -141,6 +143,7 @@ struct
|
|
| NONE => (NONE, NONE)
|
|
| NONE => (NONE, NONE)
|
|
val software = JU.lookupField nodeinfo "software"
|
|
val software = JU.lookupField nodeinfo "software"
|
|
val autoupdater = JU.asBool (JU.lookupField (JU.lookupField software "autoupdater") "enabled")
|
|
val autoupdater = JU.asBool (JU.lookupField (JU.lookupField software "autoupdater") "enabled")
|
|
|
|
+ val branch = JU.asString (JU.lookupField (JU.lookupField software "autoupdater") "branch")
|
|
val fastd = JU.asBool (JU.lookupField (JU.lookupField software "fastd") "enabled")
|
|
val fastd = JU.asBool (JU.lookupField (JU.lookupField software "fastd") "enabled")
|
|
val firmware = JU.asString (JU.lookupField (JU.lookupField software "firmware") "release")
|
|
val firmware = JU.asString (JU.lookupField (JU.lookupField software "firmware") "release")
|
|
val base = JU.asString (JU.lookupField (JU.lookupField software "firmware") "base")
|
|
val base = JU.asString (JU.lookupField (JU.lookupField software "firmware") "base")
|
|
@@ -180,6 +183,7 @@ struct
|
|
longitude = longitude,
|
|
longitude = longitude,
|
|
latitude = latitude,
|
|
latitude = latitude,
|
|
autoupdater = autoupdater,
|
|
autoupdater = autoupdater,
|
|
|
|
+ branch = branch,
|
|
gateway = gateway,
|
|
gateway = gateway,
|
|
fastd = fastd,
|
|
fastd = fastd,
|
|
firmware = firmware,
|
|
firmware = firmware,
|
|
@@ -224,7 +228,7 @@ struct
|
|
items
|
|
items
|
|
end
|
|
end
|
|
|
|
|
|
- fun node_info { hostname, online, node_id, interfaces, longitude, latitude, autoupdater, fastd, gateway, firmware, base, model, lastseen, firstseen } =
|
|
|
|
|
|
+ fun node_info { hostname, online, node_id, interfaces, longitude, latitude, autoupdater, branch, fastd, gateway, firmware, base, model, lastseen, firstseen } =
|
|
let val minitems = [
|
|
let val minitems = [
|
|
("hostname", hostname),
|
|
("hostname", hostname),
|
|
("node_id", node_id)]
|
|
("node_id", node_id)]
|
|
@@ -237,6 +241,7 @@ struct
|
|
of NONE => "NaN"
|
|
of NONE => "NaN"
|
|
| SOME l => Real.toString l),
|
|
| SOME l => Real.toString l),
|
|
("autoupdater", Bool.toString autoupdater),
|
|
("autoupdater", Bool.toString autoupdater),
|
|
|
|
+ ("branch", branch),
|
|
("fastd", Bool.toString fastd),
|
|
("fastd", Bool.toString fastd),
|
|
("gateway", gateway),
|
|
("gateway", gateway),
|
|
("firmware", firmware),
|
|
("firmware", firmware),
|
|
@@ -272,6 +277,7 @@ struct
|
|
|
|
|
|
fun main (p, [inf]) =
|
|
fun main (p, [inf]) =
|
|
(let val json = JP.parseFile inf
|
|
(let val json = JP.parseFile inf
|
|
|
|
+ val _ = get_version json = 1 orelse raise Fail "version must be 1"
|
|
val _ = get_timestamp json
|
|
val _ = get_timestamp json
|
|
val nodes_json = get_nodes json
|
|
val nodes_json = get_nodes json
|
|
handle exn => (json_handler "get_nodes" exn ; raise Fail "get_nodes")
|
|
handle exn => (json_handler "get_nodes" exn ; raise Fail "get_nodes")
|