diff --git a/src/api2/mod.rs b/src/api2/mod.rs index 132e2c2a..0ede4165 100644 --- a/src/api2/mod.rs +++ b/src/api2/mod.rs @@ -18,14 +18,12 @@ use proxmox::api::router::SubdirMap; use proxmox::api::Router; use proxmox::list_subdirs_api_method; -const NODES_ROUTER: Router = Router::new().match_all("node", &node::ROUTER); - const SUBDIRS: SubdirMap = &[ ("access", &access::ROUTER), ("admin", &admin::ROUTER), ("backup", &backup::ROUTER), ("config", &config::ROUTER), - ("nodes", &NODES_ROUTER), + ("nodes", &node::ROUTER), ("ping", &ping::ROUTER), ("pull", &pull::ROUTER), ("reader", &reader::ROUTER), diff --git a/src/api2/node/mod.rs b/src/api2/node/mod.rs index f1a17934..194ec920 100644 --- a/src/api2/node/mod.rs +++ b/src/api2/node/mod.rs @@ -315,6 +315,12 @@ fn upgrade_to_websocket( .boxed() } +#[api] +/// List Nodes (only for compatiblity) +fn list_nodes() -> Result { + Ok(json!([ { "node": proxmox::tools::nodename().to_string() } ])) +} + pub const SUBDIRS: SubdirMap = &[ ("apt", &apt::ROUTER), ("certificates", &certificates::ROUTER), @@ -338,6 +344,10 @@ pub const SUBDIRS: SubdirMap = &[ ), ]; -pub const ROUTER: Router = Router::new() +pub const ITEM_ROUTER: Router = Router::new() .get(&list_subdirs_api_method!(SUBDIRS)) .subdirs(SUBDIRS); + +pub const ROUTER: Router = Router::new() + .get(&API_METHOD_LIST_NODES) + .match_all("node", &ITEM_ROUTER);