Implement asset inventory
This commit is contained in:
+16
@@ -147,6 +147,22 @@ async fn start_hbbs_sync_async() {
|
||||
if !agent_version.is_empty() {
|
||||
v["agent_version"] = json!(agent_version);
|
||||
}
|
||||
// Optional CMDB inventory. Producer (hello-agent's
|
||||
// `inventory` module) populates this with a pre-
|
||||
// serialized JSON object covering BIOS / hardware /
|
||||
// OS-edition fields. We re-parse on each upload (the
|
||||
// string is small — single-digit kB at most) rather
|
||||
// than caching, so a refreshed inventory is picked up
|
||||
// without bookkeeping. Parse failure is silently
|
||||
// dropped: the sysinfo upload still goes out without
|
||||
// the `inventory` key, identical to a vanilla rustdesk
|
||||
// install.
|
||||
let inventory = config::INVENTORY.read().unwrap().clone();
|
||||
if !inventory.is_empty() {
|
||||
if let Ok(inv_v) = serde_json::from_str::<Value>(&inventory) {
|
||||
v["inventory"] = inv_v;
|
||||
}
|
||||
}
|
||||
let ab_name = Config::get_option(keys::OPTION_PRESET_ADDRESS_BOOK_NAME);
|
||||
if !ab_name.is_empty() {
|
||||
v[keys::OPTION_PRESET_ADDRESS_BOOK_NAME] = json!(ab_name);
|
||||
|
||||
Reference in New Issue
Block a user