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.iva...@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 via email to