From ddc5d248578e74cc2e2074e76461287150d2737c Mon Sep 17 00:00:00 2001 From: Noor Date: Fri, 13 Jun 2025 17:21:52 +0530 Subject: [PATCH] Implement follow redirect on delete and update vm --- src/snp/grpc.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/snp/grpc.rs b/src/snp/grpc.rs index 9be8310..10fd953 100644 --- a/src/snp/grpc.rs +++ b/src/snp/grpc.rs @@ -157,10 +157,9 @@ pub async fn list_contracts(req: ListVmContractsReq) -> Result, } pub async fn delete_vm(uuid: &str) -> Result<(), Error> { - let mut client = client().await?; + let client = client().await?; let req = DeleteVmReq { uuid: uuid.to_string(), admin_pubkey: Config::get_detee_wallet()? }; - let result = client.delete_vm(sign_request(req)?).await; - match result { + match call_with_follow_redirect!(client, req, delete_vm).await { Ok(confirmation) => { log::debug!("VM deletion confirmation: {confirmation:?}"); } @@ -195,9 +194,8 @@ pub async fn extend_vm(uuid: String, admin_pubkey: String, locked_nano: u64) -> pub async fn update_vm(req: UpdateVmReq) -> Result { info!("Updating VM {req:?}"); - let mut client = client().await?; - let result = client.update_vm(sign_request(req)?).await; - match result { + let client = client().await?; + match call_with_follow_redirect!(client, req, update_vm).await { Ok(resp) => { let resp = resp.into_inner(); if resp.error.is_empty() {