From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <pve-devel-bounces@lists.proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id B89D51FF17C for <inbox@lore.proxmox.com>; Wed, 30 Apr 2025 13:26:28 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A85D41FED0; Wed, 30 Apr 2025 13:26:38 +0200 (CEST) From: Christoph Heiss <c.heiss@proxmox.com> To: pve-devel@lists.proxmox.com Date: Wed, 30 Apr 2025 13:25:50 +0200 Message-ID: <20250430112628.723073-2-c.heiss@proxmox.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250430112628.723073-1-c.heiss@proxmox.com> References: <20250430112628.723073-1-c.heiss@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.028 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [main.rs, parse-answer.rs, answer.rs] Subject: [pve-devel] [RFC PATCH for-9.0 installer 2/2] auto: answer: drop deprecated snake_case keys X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/> List-Post: <mailto:pve-devel@lists.proxmox.com> List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe> Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com> This has been deprecated in PVE 8.4-1 and PBS 3.4-1, respectively. No PMG release to date with this change. The kebab-case style is preferred for all new things. Migration for users is pretty simple, for both hand-written answer files as well as on-the-fly generated ones by automated provisioning tools and such - basically a s/_/-/. Signed-off-by: Christoph Heiss <c.heiss@proxmox.com> --- Would be nice to drop them with the next major release, but if there are reasons for keeping it around for another major, disregard this patch. proxmox-auto-install-assistant/src/main.rs | 6 +++--- proxmox-auto-installer/src/answer.rs | 17 ++++------------- proxmox-auto-installer/tests/parse-answer.rs | 3 ++- .../parse_answer_fail/underscore_keys.json | 3 +++ .../parse_answer_fail/underscore_keys.toml | 14 ++++++++++++++ 5 files changed, 26 insertions(+), 17 deletions(-) create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/underscore_keys.json create mode 100644 proxmox-auto-installer/tests/resources/parse_answer_fail/underscore_keys.toml diff --git a/proxmox-auto-install-assistant/src/main.rs b/proxmox-auto-install-assistant/src/main.rs index add5053..fc8e9b2 100644 --- a/proxmox-auto-install-assistant/src/main.rs +++ b/proxmox-auto-install-assistant/src/main.rs @@ -299,7 +299,7 @@ fn validate_answer_file_keys(path: impl AsRef<Path> + fmt::Debug) -> Result<bool for (k, v) in t { if k.contains('_') { eprintln!( - "Warning: Section [{}] contains deprecated key `{k}`, use `{}` instead.", + "Error: Section [{}] contains key `{k}` which has been removed, use `{}` instead.", section.join("."), k.replace("_", "-") ); @@ -318,8 +318,8 @@ fn validate_answer_file_keys(path: impl AsRef<Path> + fmt::Debug) -> Result<bool Ok(true) } else { eprintln!( - "Warning: Answer file is using deprecated underscore keys. \ - Since PVE 8.4-1 and PBS 3.4-1, kebab-case style keys are now preferred." + "Error: Answer file is using underscore keys, which have been removed. \ + Since PVE 8.4-1 and PBS 3.4-1, kebab-case style keys are now preferred and mandantory since PVE 9.0-1." ); Ok(false) } diff --git a/proxmox-auto-installer/src/answer.rs b/proxmox-auto-installer/src/answer.rs index d0d5b78..c631b1b 100644 --- a/proxmox-auto-installer/src/answer.rs +++ b/proxmox-auto-installer/src/answer.rs @@ -10,9 +10,6 @@ use proxmox_installer_common::{ use serde::{Deserialize, Serialize}; use std::{collections::BTreeMap, io::BufRead, net::IpAddr}; -// NOTE New answer file properties must use kebab-case, but should allow snake_case for backwards -// compatibility. TODO Remove the snake_cased variants in a future major version (e.g. PVE 10). - // BTreeMap is used to store filters as the order of the filters will be stable, compared to // storing them in a HashMap @@ -51,15 +48,13 @@ pub struct Global { pub keyboard: KeyboardLayout, pub mailto: String, pub timezone: String, - #[serde(alias = "root_password")] pub root_password: Option<String>, - #[serde(alias = "root_password_hashed")] pub root_password_hashed: Option<String>, - #[serde(alias = "reboot_on_error", default)] + #[serde(default)] pub reboot_on_error: bool, - #[serde(alias = "reboot_mode", default)] + #[serde(default)] pub reboot_mode: RebootMode, - #[serde(alias = "root_ssh_keys", default)] + #[serde(default)] pub root_ssh_keys: Vec<String>, } @@ -110,7 +105,6 @@ pub struct PostNotificationHookInfo { /// URL to send a POST request to pub url: String, /// SHA256 cert fingerprint if certificate pinning should be used. - #[serde(alias = "cert_fingerprint")] pub cert_fingerprint: Option<String>, } @@ -168,7 +162,6 @@ 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>, } @@ -262,10 +255,9 @@ pub struct NetworkManual { #[serde(rename_all = "kebab-case", deny_unknown_fields)] pub struct DiskSetup { pub filesystem: Filesystem, - #[serde(alias = "disk_list", default)] + #[serde(default)] pub disk_list: Vec<String>, pub filter: Option<BTreeMap<String, String>>, - #[serde(alias = "filter_match")] pub filter_match: Option<FilterMatch>, pub zfs: Option<ZfsOptions>, pub lvm: Option<LvmOptions>, @@ -385,7 +377,6 @@ pub enum Filesystem { pub struct ZfsOptions { pub raid: Option<ZfsRaidLevel>, pub ashift: Option<usize>, - #[serde(alias = "arc_max")] pub arc_max: Option<usize>, pub checksum: Option<ZfsChecksumOption>, pub compress: Option<ZfsCompressOption>, diff --git a/proxmox-auto-installer/tests/parse-answer.rs b/proxmox-auto-installer/tests/parse-answer.rs index 34bc969..f4c3ae8 100644 --- a/proxmox-auto-installer/tests/parse-answer.rs +++ b/proxmox-auto-installer/tests/parse-answer.rs @@ -146,7 +146,8 @@ mod tests { fqdn_hostname_only, no_fqdn_from_dhcp, no_root_password_set, - short_password + short_password, + underscore_keys ); } } diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/underscore_keys.json b/proxmox-auto-installer/tests/resources/parse_answer_fail/underscore_keys.json new file mode 100644 index 0000000..484279d --- /dev/null +++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/underscore_keys.json @@ -0,0 +1,3 @@ +{ + "parse-error": "error parsing answer.toml: unknown field `root_password`, expected one of `country`, `fqdn`, `keyboard`, `mailto`, `timezone`, `root-password`, `root-password-hashed`, `reboot-on-error`, `reboot-mode`, `root-ssh-keys`" +} diff --git a/proxmox-auto-installer/tests/resources/parse_answer_fail/underscore_keys.toml b/proxmox-auto-installer/tests/resources/parse_answer_fail/underscore_keys.toml new file mode 100644 index 0000000..16f355c --- /dev/null +++ b/proxmox-auto-installer/tests/resources/parse_answer_fail/underscore_keys.toml @@ -0,0 +1,14 @@ +[global] +keyboard = "de" +country = "at" +fqdn = "pveauto.testinstall" +mailto = "mail@no.invalid" +timezone = "Europe/Vienna" +root_password = "12345678" + +[network] +source = "from-dhcp" + +[disk-setup] +filesystem = "ext4" +disk_list = ["sda"] -- 2.49.0 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel