From 145130481eac30793c6c08caa4d208ddddfc30e8 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Thu, 30 Jan 2025 10:44:08 +0100 Subject: wip: proxy admin api requests through admin rpc, prepare new cli --- src/garage/main.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/garage/main.rs') diff --git a/src/garage/main.rs b/src/garage/main.rs index ac95e854..8b5af5ea 100644 --- a/src/garage/main.rs +++ b/src/garage/main.rs @@ -6,6 +6,7 @@ extern crate tracing; mod admin; mod cli; +mod cli_v2; mod repair; mod secrets; mod server; @@ -284,10 +285,11 @@ async fn cli_command(opt: Opt) -> Result<(), Error> { let system_rpc_endpoint = netapp.endpoint::(SYSTEM_RPC_PATH.into()); let admin_rpc_endpoint = netapp.endpoint::(ADMIN_RPC_PATH.into()); - match cli_command_dispatch(opt.cmd, &system_rpc_endpoint, &admin_rpc_endpoint, id).await { - Err(HelperError::Internal(i)) => Err(Error::Message(format!("Internal error: {}", i))), - Err(HelperError::BadRequest(b)) => Err(Error::Message(b)), - Err(e) => Err(Error::Message(format!("{}", e))), - Ok(x) => Ok(x), - } + let cli = cli_v2::Cli { + system_rpc_endpoint, + admin_rpc_endpoint, + rpc_host: id, + }; + + cli.handle(opt.cmd).await } -- cgit v1.2.3