mirror of
https://git.proxmox.com/git/pve-installer
synced 2025-07-17 11:08:31 +00:00
fix #5889: assistant: validate answer email & root password settings
These checks are basically "free" and can be re-used from the auto-installer 1:1. Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
This commit is contained in:
parent
3da534fd65
commit
8341108e18
@ -11,11 +11,11 @@ use std::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use proxmox_auto_installer::{
|
use proxmox_auto_installer::{
|
||||||
answer::Answer,
|
answer::{Answer, FilterMatch},
|
||||||
answer::FilterMatch,
|
|
||||||
sysinfo::SysInfo,
|
sysinfo::SysInfo,
|
||||||
utils::{
|
utils::{
|
||||||
get_matched_udev_indexes, get_nic_list, get_single_udev_index, AutoInstSettings,
|
get_matched_udev_indexes, get_nic_list, get_single_udev_index,
|
||||||
|
verify_email_and_root_password_settings, AutoInstSettings,
|
||||||
FetchAnswerFrom, HttpOptions,
|
FetchAnswerFrom, HttpOptions,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -591,7 +591,8 @@ fn parse_answer(path: impl AsRef<Path> + fmt::Debug) -> Result<Answer> {
|
|||||||
}
|
}
|
||||||
match toml::from_str(&contents) {
|
match toml::from_str(&contents) {
|
||||||
Ok(answer) => {
|
Ok(answer) => {
|
||||||
println!("The file was parsed successfully, no syntax errors found!");
|
verify_email_and_root_password_settings(&answer)?;
|
||||||
|
println!("The answer file was parsed successfully, no errors found!");
|
||||||
Ok(answer)
|
Ok(answer)
|
||||||
}
|
}
|
||||||
Err(err) => bail!("Error parsing answer file: {err}"),
|
Err(err) => bail!("Error parsing answer file: {err}"),
|
||||||
|
@ -320,7 +320,7 @@ fn verify_locale_settings(answer: &Answer, locales: &LocaleInfo) -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn verify_email_and_root_password_settings(answer: &Answer) -> Result<()> {
|
pub fn verify_email_and_root_password_settings(answer: &Answer) -> Result<()> {
|
||||||
info!("Verifying email and root password settings");
|
info!("Verifying email and root password settings");
|
||||||
|
|
||||||
email_validate(&answer.global.mailto).with_context(|| answer.global.mailto.clone())?;
|
email_validate(&answer.global.mailto).with_context(|| answer.global.mailto.clone())?;
|
||||||
|
Loading…
Reference in New Issue
Block a user