From 3715f3ccbe80d9c9cab1ca8ffd8a37eb188810d3 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Tue, 23 Apr 2024 18:26:55 +0200 Subject: [PATCH] assistant: fix mentioning outdated fetch-from mode in error ... and unify the branches for non-http mode. Signed-off-by: Thomas Lamprecht --- proxmox-auto-install-assistant/src/main.rs | 29 ++++++++++------------ 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/proxmox-auto-install-assistant/src/main.rs b/proxmox-auto-install-assistant/src/main.rs index be0471c..a1c2ab5 100644 --- a/proxmox-auto-install-assistant/src/main.rs +++ b/proxmox-auto-install-assistant/src/main.rs @@ -279,24 +279,21 @@ fn prepare_iso(args: &CommandPrepareISO) -> Result<()> { if args.fetch_from == FetchAnswerFrom::Iso { if args.answer_file.is_none() { - bail!("Missing path to answer file needed for 'included' install mode."); - } - if args.cert_fingerprint.is_some() { - bail!("No certificate fingerprint needed for 'included' install mode. Drop the parameter!"); - } - if args.url.is_some() { - bail!("No URL needed for 'included' install mode. Drop the parameter!"); - } - } else if args.fetch_from == FetchAnswerFrom::Partition { - if args.cert_fingerprint.is_some() { - bail!( - "No certificate fingerprint needed for partition install mode. Drop the parameter!" - ); - } - if args.url.is_some() { - bail!("No URL needed for partition install mode. Drop the parameter!"); + bail!("Missing path to the answer file required for the fetch-from 'iso' mode."); } } + if args.url.is_some() && args.fetch_from != FetchAnswerFrom::Http { + bail!( + "Setting a URL is incompatible with the fetch-from '{:?}' mode, only works with the 'http' mode", + args.fetch_from, + ); + } + if args.cert_fingerprint.is_some() && args.fetch_from != FetchAnswerFrom::Http { + bail!( + "Setting a certificate fingerprint incompatible is fetch-from '{:?}' mode, only works for 'http' mode.", + args.fetch_from, + ); + } if args.answer_file.is_some() && args.fetch_from != FetchAnswerFrom::Iso { bail!("Set '-i', '--install-mode' to 'included' to place the answer file directly in the ISO."); } -- 2.39.5