From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 6063E1FF16F for ; Tue, 24 Jun 2025 13:40:38 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 8AEDC356A5; Tue, 24 Jun 2025 13:41:10 +0200 (CEST) From: Christoph Heiss To: pve-devel@lists.proxmox.com Date: Tue, 24 Jun 2025 13:40:54 +0200 Message-ID: <20250624114102.901342-2-c.heiss@proxmox.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250624114102.901342-1-c.heiss@proxmox.com> References: <20250624114102.901342-1-c.heiss@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.029 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. [answer.rs, main.rs, parse-answer.rs] Subject: [pve-devel] [PATCH installer v2 2/2] [for-9.0] 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" This has been deprecated in PVE 8.4-1 and PBS 3.4-1, respectively. The kebab-case style is preferred for all new things. Signed-off-by: Christoph Heiss --- Changes v1 -> v2: * rebased on latest master Would be nice to drop them with the next major release, if there are no good reasons to keep them around for another major release. The migration/fix for users is pretty simple too, for both hand-written answer files as well as on-the-fly generated ones from automated provisioning tools and such - basically a s/_/-/. 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 320de2d..7e1f780 100644 --- a/proxmox-auto-install-assistant/src/main.rs +++ b/proxmox-auto-install-assistant/src/main.rs @@ -519,7 +519,7 @@ fn validate_answer_file_keys(path: impl AsRef + fmt::Debug) -> Result + fmt::Debug) -> Result, - #[serde(alias = "root_password_hashed")] pub root_password_hashed: Option, - #[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, } @@ -109,7 +104,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, } @@ -167,7 +161,6 @@ pub struct FirstBootHookInfo { /// Retrieve the post-install script from a URL, if source == "from-url". pub url: Option, /// SHA256 cert fingerprint if certificate pinning should be used, if source == "from-url". - #[serde(alias = "cert_fingerprint")] pub cert_fingerprint: Option, } @@ -261,10 +254,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, pub filter: Option>, - #[serde(alias = "filter_match")] pub filter_match: Option, pub zfs: Option, pub lvm: Option, @@ -387,7 +379,6 @@ pub enum Filesystem { pub struct ZfsOptions { pub raid: Option, pub ashift: Option, - #[serde(alias = "arc_max")] pub arc_max: Option, pub checksum: Option, pub compress: Option, 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