From: "Lukas Wagner" <l.wagner@proxmox.com>
To: "Christoph Heiss" <c.heiss@proxmox.com>, <pdm-devel@lists.proxmox.com>
Subject: Re: [PATCH proxmox 02/16] installer-types: post-hook: factor schema version into proper struct
Date: Tue, 04 Aug 2026 13:39:06 +0200 [thread overview]
Message-ID: <DKG4PBAXCWFE.2JKNVK963WO3Z@proxmox.com> (raw)
In-Reply-To: <20260731143910.936881-3-c.heiss@proxmox.com>
On Fri Jul 31, 2026 at 4:35 PM CEST, Christoph Heiss wrote:
> This simplifies first and foremost version comparison on consumer sites,
> making the schema version actually useful.
>
> No actual API changes, the version is still serialized to/deserialized
> from a plain X.Y string.
>
> Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
> ---
> proxmox-installer-types/src/answer.rs | 68 +++++++++++++++++++++---
> proxmox-installer-types/src/lib.rs | 18 +++++++
> proxmox-installer-types/src/post_hook.rs | 13 +++--
> 3 files changed, 90 insertions(+), 9 deletions(-)
>
> diff --git a/proxmox-installer-types/src/answer.rs b/proxmox-installer-types/src/answer.rs
> index 266d6a27..68cac026 100644
> --- a/proxmox-installer-types/src/answer.rs
> +++ b/proxmox-installer-types/src/answer.rs
> @@ -9,6 +9,7 @@
> use anyhow::{Result, anyhow, bail};
> use serde::{Deserialize, Serialize};
> use std::{
> + cmp::Ordering,
> collections::{BTreeMap, HashMap},
> fmt::{self, Display},
> str::FromStr,
> @@ -63,6 +64,38 @@ pub const SUBSCRIPTION_KEY_SCHEMA: proxmox_schema::Schema =
> .max_length(32)
> .schema();
>
> +/// Represents a (major, minor) schema version tuple.
> +#[derive(Copy, Clone, Debug, PartialEq, Eq)]
> +pub struct SchemaVersion(pub u32, pub u32);
> +
> +impl PartialOrd for SchemaVersion {
> + fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
> + match (self.0.cmp(&other.0), self.1.cmp(&other.1)) {
> + (Ordering::Equal, ord) => Some(ord),
> + (ord, _) => Some(ord),
> + }
> + }
You could use Ordering::then to simplify this, e.g.
Some(self.0.cmp(&other.0).then(self.1.cmp(&other.1)))
https://doc.rust-lang.org/std/cmp/enum.Ordering.html#method.then
You could also use it in the partial_cmp implementation of
`ProductVersion`, spotted the same there as well.
next prev parent reply other threads:[~2026-08-04 11:39 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 14:35 [PATCH proxmox/installer/datacenter-manager 00/16] auto-installer: add installed target systems as new remotes Christoph Heiss
2026-07-31 14:35 ` [PATCH proxmox 01/16] installer-types: drop unnecessary clippy attribute Christoph Heiss
2026-07-31 14:35 ` [PATCH proxmox 02/16] installer-types: post-hook: factor schema version into proper struct Christoph Heiss
2026-08-04 11:39 ` Lukas Wagner [this message]
2026-07-31 14:35 ` [PATCH proxmox 03/16] installer-types: post-hook: allow additional properties on api schema Christoph Heiss
2026-07-31 14:35 ` [PATCH proxmox 04/16] installer-types: post-hook: add api-token and cert-fingerprint options Christoph Heiss
2026-07-31 14:35 ` [PATCH proxmox 05/16] installer-types: systeminfo: add check for API token creation capability Christoph Heiss
2026-08-04 11:39 ` Lukas Wagner
2026-07-31 14:35 ` [PATCH installer 06/16] chroot: print full error if bind-mounting fails Christoph Heiss
2026-07-31 14:35 ` [PATCH installer 07/16] post-hook: re-use low-level config retrieval from proxmox-chroot Christoph Heiss
2026-07-31 14:35 ` [PATCH installer 08/16] post-hook: generate and retrieve node certificate fingerprint Christoph Heiss
2026-08-04 11:39 ` Lukas Wagner
2026-07-31 14:35 ` [PATCH installer 09/16] post-hook: support creating API token if requested in answer file Christoph Heiss
2026-08-04 11:39 ` Lukas Wagner
2026-07-31 14:35 ` [PATCH installer 10/16] auto: enforce https for post hook when generating an API token Christoph Heiss
2026-07-31 14:35 ` [PATCH installer 11/16] assistant: validate-answer: also verify post-hook settings if set Christoph Heiss
2026-07-31 14:35 ` [PATCH datacenter-manager 12/16] ui: auto-installer: spell out Proxmox Datacenter Manager Christoph Heiss
2026-07-31 14:35 ` [PATCH datacenter-manager 13/16] config: auto-install: add optional `post-hook-add-as-remote` field Christoph Heiss
2026-07-31 14:35 ` [PATCH datacenter-manager 14/16] api: auto-installer: add option for adding new remotes to PDM Christoph Heiss
2026-07-31 14:35 ` [PATCH datacenter-manager 15/16] ui: auto-installer: wizard: add checkbox to add target as new remote Christoph Heiss
2026-08-04 11:39 ` Lukas Wagner
2026-07-31 14:35 ` [PATCH datacenter-manager 16/16] docs: auto-installer: document adding targets as remotes afterwards Christoph Heiss
2026-07-31 22:05 ` Unsuscribe Pablo Méndez Segura
2026-08-04 11:39 ` [PATCH datacenter-manager 16/16] docs: auto-installer: document adding targets as remotes afterwards Lukas Wagner
2026-08-04 11:38 ` [PATCH proxmox/installer/datacenter-manager 00/16] auto-installer: add installed target systems as new remotes Lukas Wagner
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=DKG4PBAXCWFE.2JKNVK963WO3Z@proxmox.com \
--to=l.wagner@proxmox.com \
--cc=c.heiss@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