public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH installer] assistant: error out on set network config for dhcp
Date: Tue, 23 Apr 2024 17:18:06 +0200	[thread overview]
Message-ID: <20240423151806.2665929-1-s.ivanov@proxmox.com> (raw)

potentially will not happen too often in practice if the sample files
always contain the right source. Still having settings in an answer
file that get ignored does not seem right.

tested with `validate-answer` on a file without `source` in the
network section (which initially caused confusion for me)

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 proxmox-auto-installer/src/answer.rs | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/proxmox-auto-installer/src/answer.rs b/proxmox-auto-installer/src/answer.rs
index de8a360..df20db3 100644
--- a/proxmox-auto-installer/src/answer.rs
+++ b/proxmox-auto-installer/src/answer.rs
@@ -87,6 +87,19 @@ impl TryFrom<NetworkInAnswer> for Network {
                 }),
             })
         } else {
+            if network.cidr.is_some() {
+                return Err("Field 'cidr' not supported for 'from-dhcp' config.");
+            }
+            if network.dns.is_some() {
+                return Err("Field 'dns' not supported for 'from-dhcp' config.");
+            }
+            if network.gateway.is_some() {
+                return Err("Field 'gateway' not supported for 'from-dhcp' config.");
+            }
+            if network.filter.is_some() {
+                return Err("Field 'filter' not supported for 'from-dhcp' config.");
+            }
+
             Ok(Network {
                 network_settings: NetworkSettings::FromDhcp,
             })
-- 
2.39.2



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


             reply	other threads:[~2024-04-23 15:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23 15:18 Stoiko Ivanov [this message]
2024-04-23 16:31 ` [pve-devel] applied: " Thomas Lamprecht

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=20240423151806.2665929-1-s.ivanov@proxmox.com \
    --to=s.ivanov@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 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