[pve-devel] [PATCH installer] assistant: error out on set network config for dhcp

Stoiko Ivanov s.ivanov at proxmox.com
Tue Apr 23 17:18:06 CEST 2024


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 at 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





More information about the pve-devel mailing list