fix(fmt): apply cargo fmt to resolve CI formatting check failure
All checks were successful
Test / frontend-typecheck (pull_request) Successful in 1m51s
Test / frontend-tests (pull_request) Successful in 1m44s
PR Review Automation / review (pull_request) Successful in 6m43s
Test / rust-fmt-check (pull_request) Successful in 12m17s
Test / rust-clippy (pull_request) Successful in 14m1s
Test / rust-tests (pull_request) Successful in 15m36s

This commit is contained in:
Shaun Arman 2026-06-21 16:18:23 -05:00
parent 627373f433
commit c3298b2d77
2 changed files with 49 additions and 24 deletions

View File

@ -716,7 +716,10 @@ pub async fn list_proxmox_datastores(
format!("storage/{}/{}", node_name, storage_name) format!("storage/{}/{}", node_name, storage_name)
}; };
if storage_name.is_empty() { if storage_name.is_empty() {
tracing::warn!(node = node_name, "storage entry has empty storage name — skipping"); tracing::warn!(
node = node_name,
"storage entry has empty storage name — skipping"
);
return None; return None;
} }
tracing::debug!(storage_id = %storage_id, "generated storage ID"); tracing::debug!(storage_id = %storage_id, "generated storage ID");
@ -744,10 +747,7 @@ pub async fn list_proxmox_datastores(
.and_then(|v| v.as_str()) .and_then(|v| v.as_str())
.unwrap_or("") .unwrap_or("")
.to_string(); .to_string();
normalized.insert( normalized.insert("content".to_string(), serde_json::Value::String(content));
"content".to_string(),
serde_json::Value::String(content),
);
normalized.insert( normalized.insert(
"node".to_string(), "node".to_string(),
@ -759,9 +759,18 @@ pub async fn list_proxmox_datastores(
let disk_total = obj.get("maxdisk").and_then(|v| v.as_u64()).unwrap_or(0); let disk_total = obj.get("maxdisk").and_then(|v| v.as_u64()).unwrap_or(0);
let disk_avail = disk_total.saturating_sub(disk_used); let disk_avail = disk_total.saturating_sub(disk_used);
normalized.insert("used".to_string(), serde_json::Value::Number(disk_used.into())); normalized.insert(
normalized.insert("size".to_string(), serde_json::Value::Number(disk_total.into())); "used".to_string(),
normalized.insert("available".to_string(), serde_json::Value::Number(disk_avail.into())); serde_json::Value::Number(disk_used.into()),
);
normalized.insert(
"size".to_string(),
serde_json::Value::Number(disk_total.into()),
);
normalized.insert(
"available".to_string(),
serde_json::Value::Number(disk_avail.into()),
);
let status = obj let status = obj
.get("status") .get("status")

View File

@ -45,10 +45,22 @@ pub async fn list_firewall_rules(
let rule_num = rule.get("pos").and_then(|v| v.as_u64()).unwrap_or(0) as u32; let rule_num = rule.get("pos").and_then(|v| v.as_u64()).unwrap_or(0) as u32;
let action = rule.get("action").and_then(|v| v.as_str())?.to_string(); let action = rule.get("action").and_then(|v| v.as_str())?.to_string();
// PVE uses "proto" not "protocol" // PVE uses "proto" not "protocol"
let protocol = rule.get("proto").and_then(|v| v.as_str()).unwrap_or("").to_string(); let protocol = rule
.get("proto")
.and_then(|v| v.as_str())
.unwrap_or("")
.to_string();
// source and dest are optional fields // source and dest are optional fields
let source = rule.get("source").and_then(|v| v.as_str()).unwrap_or("").to_string(); let source = rule
let destination = rule.get("dest").and_then(|v| v.as_str()).unwrap_or("").to_string(); .get("source")
.and_then(|v| v.as_str())
.unwrap_or("")
.to_string();
let destination = rule
.get("dest")
.and_then(|v| v.as_str())
.unwrap_or("")
.to_string();
let port = rule let port = rule
.get("dport") .get("dport")
.or_else(|| rule.get("sport")) .or_else(|| rule.get("sport"))
@ -57,11 +69,7 @@ pub async fn list_firewall_rules(
// PVE uses "enable" as integer (1=enabled, 0=disabled), not "enabled" bool // PVE uses "enable" as integer (1=enabled, 0=disabled), not "enabled" bool
let enabled = rule let enabled = rule
.get("enable") .get("enable")
.and_then(|e| { .and_then(|e| e.as_i64().map(|n| n != 0).or_else(|| e.as_bool()))
e.as_i64()
.map(|n| n != 0)
.or_else(|| e.as_bool())
})
.unwrap_or(true); .unwrap_or(true);
Some(FirewallRule { Some(FirewallRule {
@ -225,9 +233,21 @@ pub async fn get_firewall_status(
.filter_map(|rule| { .filter_map(|rule| {
let rule_num = rule.get("pos").and_then(|v| v.as_u64()).unwrap_or(0) as u32; let rule_num = rule.get("pos").and_then(|v| v.as_u64()).unwrap_or(0) as u32;
let action = rule.get("action").and_then(|v| v.as_str())?.to_string(); let action = rule.get("action").and_then(|v| v.as_str())?.to_string();
let protocol = rule.get("proto").and_then(|v| v.as_str()).unwrap_or("").to_string(); let protocol = rule
let source = rule.get("source").and_then(|v| v.as_str()).unwrap_or("").to_string(); .get("proto")
let destination = rule.get("dest").and_then(|v| v.as_str()).unwrap_or("").to_string(); .and_then(|v| v.as_str())
.unwrap_or("")
.to_string();
let source = rule
.get("source")
.and_then(|v| v.as_str())
.unwrap_or("")
.to_string();
let destination = rule
.get("dest")
.and_then(|v| v.as_str())
.unwrap_or("")
.to_string();
let port = rule let port = rule
.get("dport") .get("dport")
.or_else(|| rule.get("sport")) .or_else(|| rule.get("sport"))
@ -235,11 +255,7 @@ pub async fn get_firewall_status(
.map(|s| s.to_string()); .map(|s| s.to_string());
let enabled = rule let enabled = rule
.get("enable") .get("enable")
.and_then(|e| { .and_then(|e| e.as_i64().map(|n| n != 0).or_else(|| e.as_bool()))
e.as_i64()
.map(|n| n != 0)
.or_else(|| e.as_bool())
})
.unwrap_or(true); .unwrap_or(true);
Some(FirewallRule { Some(FirewallRule {