From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 438741FF178 for ; Mon, 15 Dec 2025 17:21:08 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 396C311DB9; Mon, 15 Dec 2025 17:21:53 +0100 (CET) From: Shannon Sterz To: pdm-devel@lists.proxmox.com Date: Mon, 15 Dec 2025 17:21:29 +0100 Message-ID: <20251215162129.403124-3-s.sterz@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251215162129.403124-2-s.sterz@proxmox.com> References: <20251215162129.403124-2-s.sterz@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1765815701942 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.089 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pdm-devel] [PATCH datacenter-manager 1/2] cli: admin: add `support-eligibility` subcommand X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" add cli methods to allow updating and checking the subscription information of pdm itself. before, the cli only had a cli method that prints the subscription status for each remote without providing information on whether the pdm host itself is eligible for support. the term `support-eligiblity` for the subcommand was chosen over `subscription`, because: 1. there are no subscriptions for pdm itself, only for the remotes it is connected to. users may be confused that they can't set a subscription here like they can with other proxmox products 2. avoid confusion with the `remote subscriptions` subcommand Signed-off-by: Shannon Sterz --- cli/admin/src/main.rs | 2 + cli/admin/src/support_eligibility.rs | 66 ++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 cli/admin/src/support_eligibility.rs diff --git a/cli/admin/src/main.rs b/cli/admin/src/main.rs index e6a74df..f4cbc80 100644 --- a/cli/admin/src/main.rs +++ b/cli/admin/src/main.rs @@ -9,6 +9,7 @@ use proxmox_router::RpcEnvironment; use proxmox_schema::api; mod remotes; +mod support_eligibility; fn main() { //pbs_tools::setup_libc_malloc_opts(); // TODO: move from PBS to proxmox-sys and uncomment @@ -36,6 +37,7 @@ fn main() { "report", CliCommand::new(&API_METHOD_GENERATE_SYSTEM_REPORT), ) + .insert("support-eligibility", support_eligibility::cli()) .insert("versions", CliCommand::new(&API_METHOD_GET_VERSIONS)); let mut rpcenv = CliEnvironment::new(); diff --git a/cli/admin/src/support_eligibility.rs b/cli/admin/src/support_eligibility.rs new file mode 100644 index 0000000..0f2cfca --- /dev/null +++ b/cli/admin/src/support_eligibility.rs @@ -0,0 +1,66 @@ +use serde_json::{json, Value}; + +use proxmox_router::cli::{ + format_and_print_result_full, get_output_format, CliCommand, CliCommandMap, + CommandLineInterface, +}; +use proxmox_router::{ApiHandler, RpcEnvironment}; +use proxmox_schema::api; + +pub fn cli() -> CommandLineInterface { + CliCommandMap::new() + .insert("get", CliCommand::new(&API_METHOD_SUPPORT_ELIGIBILITY)) + .insert( + "update", + CliCommand::new(&API_METHOD_UPDATE_SUPPORT_ELIGIBILITY), + ) + .into() +} + +#[api] +/// Get the support eligibility information. +async fn support_eligibility( + param: Value, + rpcenv: &mut dyn RpcEnvironment, +) -> Result<(), anyhow::Error> { + let info = &server::api::nodes::subscription::API_METHOD_GET_SUBSCRIPTION; + + let mut data = match info.handler { + ApiHandler::Async(handler) => (handler)(json!({}), info, rpcenv).await?, + _ => unreachable!(), + }; + + let output_format = get_output_format(¶m); + + format_and_print_result_full( + &mut data, + &info.returns, + &output_format, + &Default::default(), + ); + Ok(()) +} + +#[api] +/// Update the support eligibility information. +async fn update_support_eligibility( + param: Value, + rpcenv: &mut dyn RpcEnvironment, +) -> Result<(), anyhow::Error> { + let info = &server::api::nodes::subscription::API_METHOD_CHECK_SUBSCRIPTION; + + let mut data = match info.handler { + ApiHandler::Async(handler) => (handler)(json!({}), info, rpcenv).await?, + _ => unreachable!(), + }; + + let output_format = get_output_format(¶m); + + format_and_print_result_full( + &mut data, + &info.returns, + &output_format, + &Default::default(), + ); + Ok(()) +} -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel