public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Shannon Sterz <s.sterz@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager v2 1/2] cli: admin: add `support-status` subcommand
Date: Tue, 16 Dec 2025 11:08:24 +0100	[thread overview]
Message-ID: <20251216100824.72169-3-s.sterz@proxmox.com> (raw)
In-Reply-To: <20251216100824.72169-2-s.sterz@proxmox.com>

add cli methods to allow updating and checking the subscription
information of pdm itself. before, the cli only had a 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-status` 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 <s.sterz@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 cli/admin/src/main.rs           |  2 ++
 cli/admin/src/support_status.rs | 63 +++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+)
 create mode 100644 cli/admin/src/support_status.rs

diff --git a/cli/admin/src/main.rs b/cli/admin/src/main.rs
index e6a74df..f698fa2 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_status;

 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-status", support_status::cli())
         .insert("versions", CliCommand::new(&API_METHOD_GET_VERSIONS));

     let mut rpcenv = CliEnvironment::new();
diff --git a/cli/admin/src/support_status.rs b/cli/admin/src/support_status.rs
new file mode 100644
index 0000000..89ccf6e
--- /dev/null
+++ b/cli/admin/src/support_status.rs
@@ -0,0 +1,63 @@
+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_STATUS))
+        .insert("update", CliCommand::new(&API_METHOD_UPDATE_SUPPORT_STATUS))
+        .into()
+}
+
+#[api]
+/// Get the support status information.
+async fn support_status(
+    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(&param);
+
+    format_and_print_result_full(
+        &mut data,
+        &info.returns,
+        &output_format,
+        &Default::default(),
+    );
+    Ok(())
+}
+
+#[api]
+/// Update the support status information.
+async fn update_support_status(
+    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(&param);
+
+    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


  reply	other threads:[~2025-12-16 10:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-16 10:08 [pdm-devel] [PATCH datacenter-manager v2 0/2] support eligibility checking in the cli Shannon Sterz
2025-12-16 10:08 ` Shannon Sterz [this message]
2025-12-16 10:08 ` [pdm-devel] [PATCH datacenter-manager v2 2/2] server: add the new `support-status` subcommand to the report Shannon Sterz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251216100824.72169-3-s.sterz@proxmox.com \
    --to=s.sterz@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal