fix: resolve Proxmox authentication response parsing error #126

Merged
sarman merged 4 commits from fix/proxmox-auth-decoding into beta 2026-06-21 03:13:38 +00:00
Showing only changes of commit bad3042d2d - Show all commits

View File

@ -458,7 +458,10 @@ mod tests {
}; };
let mut client = ProxmoxClient::new("172.0.0.18", 8006, "root@pam"); let mut client = ProxmoxClient::new("172.0.0.18", 8006, "root@pam");
client.authenticate(&password).await.expect("Authentication failed"); client
.authenticate(&password)
.await
.expect("Authentication failed");
#[derive(serde::Deserialize, Debug)] #[derive(serde::Deserialize, Debug)]
struct Resource { struct Resource {
@ -470,7 +473,9 @@ mod tests {
status: Option<String>, status: Option<String>,
} }
let result: Result<Vec<Resource>, _> = client.get("cluster/resources", client.ticket.as_deref()).await; let result: Result<Vec<Resource>, _> = client
.get("cluster/resources", client.ticket.as_deref())
.await;
match result { match result {
Ok(resources) => { Ok(resources) => {
println!("✓ Cluster resources fetched successfully"); println!("✓ Cluster resources fetched successfully");
@ -498,7 +503,10 @@ mod tests {
}; };
let mut client = ProxmoxClient::new("proxmox-server", 8006, "root@pam"); let mut client = ProxmoxClient::new("proxmox-server", 8006, "root@pam");
client.authenticate(&password).await.expect("Authentication failed"); client
.authenticate(&password)
.await
.expect("Authentication failed");
#[derive(serde::Deserialize, Debug)] #[derive(serde::Deserialize, Debug)]
struct Node { struct Node {
@ -537,7 +545,10 @@ mod tests {
}; };
let mut client = ProxmoxClient::new("proxmox-server", 8006, "root@pam"); let mut client = ProxmoxClient::new("proxmox-server", 8006, "root@pam");
client.authenticate(&password).await.expect("Authentication failed"); client
.authenticate(&password)
.await
.expect("Authentication failed");
#[derive(serde::Deserialize, Debug)] #[derive(serde::Deserialize, Debug)]
struct Resource { struct Resource {
@ -548,10 +559,15 @@ mod tests {
status: Option<String>, status: Option<String>,
} }
let result: Result<Vec<Resource>, _> = client.get("cluster/resources", client.ticket.as_deref()).await; let result: Result<Vec<Resource>, _> = client
.get("cluster/resources", client.ticket.as_deref())
.await;
match result { match result {
Ok(resources) => { Ok(resources) => {
let vms: Vec<_> = resources.into_iter().filter(|r| r.r#type.as_deref() == Some("qemu")).collect(); let vms: Vec<_> = resources
.into_iter()
.filter(|r| r.r#type.as_deref() == Some("qemu"))
.collect();
println!("✓ VMs fetched successfully"); println!("✓ VMs fetched successfully");
println!(" Found {} VMs", vms.len()); println!(" Found {} VMs", vms.len());
} }