all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Daniel Kral <d.kral@proxmox.com>
Subject: Re: [pve-devel] [RFC PATCH installer] fix #5973: auto: first boot: allow snake- and kebabcased property names
Date: Tue, 28 Jan 2025 15:38:02 +0100	[thread overview]
Message-ID: <f7b6603b-4423-464e-8fc2-0df5ed956650@proxmox.com> (raw)
In-Reply-To: <20241205140721.207021-1-d.kral@proxmox.com>

Am 05.12.24 um 15:07 schrieb Daniel Kral:
> Allow the names for the [first-boot] properties to be parsed as either
> snake_cased or kebab-cased strings, i.e. `cert_fingerprint` or
> `cert-fingerprint`, to have consistent property name casings. Currently,
> this only affects the `cert_fingerprint`.
> 
> This change does not break API as it preserves the kebabcased variant
> `cert-fingerprint`, but as this change propagates to the auto-installer,
> using the snakecased `cert_fingerprint` will result in a parse error
> during auto installation on any unpatched ISO (e.g. Proxmox VE 8.3-1).
> 
> Signed-off-by: Daniel Kral <d.kral@proxmox.com>
> ---
> I have tested this by setting up a small HTTPS server with Python's
> `http.server` and `ssl.wrap_socket()` on my local machine and creating
> two different ISOs (with the Proxmox VE 8.3-1 ISO):
> 
> - with `cert-fingerprint` (which works correctly as expected), and
> - with `cert_fingerprint` (which will fail at a parser error with the
> newest Proxmox VE 8.3-1 ISO).

This is a bit worded like that behavior would be a regression, but it
isn't AFAICT as this was always kebab-case from when being added in
commit 6526662 ("fix #5579: auto-installer: add optional first-boot hook
script"); or am I overlooking something?

> 
> I've also tested the change by booting the ISO in debug mode and copying
> over the recompiled binaries, setting up the environment and running the
> auto installation with `proxmox-fetch-answer | proxmox-auto-installer`,
> which worked as expected.
> 
>  proxmox-auto-installer/src/answer.rs | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/proxmox-auto-installer/src/answer.rs b/proxmox-auto-installer/src/answer.rs
> index c206fcc..04c0ace 100644
> --- a/proxmox-auto-installer/src/answer.rs
> +++ b/proxmox-auto-installer/src/answer.rs
> @@ -107,7 +107,7 @@ impl FirstBootHookServiceOrdering {
>  /// Describes from where to fetch the first-boot hook script, either being baked into the ISO or
>  /// from a URL.
>  #[derive(Clone, Deserialize, Debug)]
> -#[serde(rename_all = "kebab-case", deny_unknown_fields)]
> +#[serde(deny_unknown_fields)]

But we prefer kebab-case for any public API/CLI parameter for modern code;
so shouldn't we rather to the opposite, transform all other (de)serializable
configs to use kebab-case with backward-compat aliases for the cases it
matters?

>  pub struct FirstBootHookInfo {
>      /// Mode how to retrieve the first-boot executable file, either from an URL or from the ISO if
>      /// it has been baked-in.
> @@ -118,6 +118,7 @@ pub struct FirstBootHookInfo {
>      /// Retrieve the post-install script from a URL, if source == "from-url".
>      pub url: Option<String>,
>      /// SHA256 cert fingerprint if certificate pinning should be used, if source == "from-url".
> +    #[serde(alias = "cert-fingerprint")]
>      pub cert_fingerprint: Option<String>,
>  }
>  



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  reply	other threads:[~2025-01-28 14:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-05 14:07 Daniel Kral
2025-01-28 14:38 ` Thomas Lamprecht [this message]
2025-01-29  9:34   ` Christoph Heiss
2025-01-30  9:11   ` Daniel Kral
2025-01-30 10:06     ` Thomas Lamprecht
2025-02-17 12:21 ` Daniel Kral

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=f7b6603b-4423-464e-8fc2-0df5ed956650@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=d.kral@proxmox.com \
    --cc=pve-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal