[pdm-devel] [PATCH proxmox-backup 4/4] api: termproxy: use NodeShellTicket type from pbs-api-types
Fabian Grünbichler
f.gruenbichler at proxmox.com
Tue Nov 11 09:29:20 CET 2025
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
Notes:
new in v1, requires bumped pbs-api-types
src/api2/node/mod.rs | 40 ++++++++++++----------------------------
1 file changed, 12 insertions(+), 28 deletions(-)
diff --git a/src/api2/node/mod.rs b/src/api2/node/mod.rs
index a5ec903a7..42e1dbaa2 100644
--- a/src/api2/node/mod.rs
+++ b/src/api2/node/mod.rs
@@ -25,7 +25,7 @@ use proxmox_schema::*;
use proxmox_sortable_macro::sortable;
use proxmox_sys::fd::fd_change_cloexec;
-use pbs_api_types::{Userid, NODE_SCHEMA, PRIV_SYS_CONSOLE};
+use pbs_api_types::{NodeShellTicket, NODE_SCHEMA, PRIV_SYS_CONSOLE};
use tracing::{info, warn};
use crate::auth::{private_auth_keyring, public_auth_keyring};
@@ -70,26 +70,7 @@ pub const SHELL_CMD_SCHEMA: Schema = StringSchema::new("The command to run.")
},
},
returns: {
- type: Object,
- description: "Object with the user, ticket, port and upid",
- properties: {
- user: {
- description: "",
- type: String,
- },
- ticket: {
- description: "",
- type: String,
- },
- port: {
- description: "",
- type: String,
- },
- upid: {
- description: "",
- type: String,
- },
- }
+ type: NodeShellTicket,
},
access: {
description: "The user needs Sys.Console on /system.",
@@ -97,7 +78,10 @@ pub const SHELL_CMD_SCHEMA: Schema = StringSchema::new("The command to run.")
}
)]
/// Call termproxy and return shell ticket
-async fn termproxy(cmd: Option<String>, rpcenv: &mut dyn RpcEnvironment) -> Result<Value, Error> {
+async fn termproxy(
+ cmd: Option<String>,
+ rpcenv: &mut dyn RpcEnvironment,
+) -> Result<NodeShellTicket, Error> {
let root_auth_id = Authid::root_auth_id();
// intentionally user only for now
@@ -228,12 +212,12 @@ async fn termproxy(cmd: Option<String>, rpcenv: &mut dyn RpcEnvironment) -> Resu
},
)?;
- Ok(json!({
- "user": auth_id,
- "ticket": ticket,
- "port": port,
- "upid": upid,
- }))
+ Ok(NodeShellTicket {
+ user: auth_id,
+ ticket,
+ port,
+ upid,
+ })
}
#[sortable]
--
2.47.3
More information about the pdm-devel
mailing list