Back in https://forum.proxmox.com/threads/proxmox-ais-question-request.153043/#post-695689 I had requested the "--partition-label" flag with proxmox-automatic-install-assistant tool. It works well but I was troubleshooting a hardware driver issue on some new servers, so I had to rebuild my iso. When I customized proxmox-installer prior, I also configured the program to search for any answer.toml file in the directory, not just "/mnt/answer/answer.toml". This lets me save each answer file and tie it to the server I'm currently configuring, allowing them to run in parallel. Currently, using the Dell Server Configuration Profile method, I can only refer to a file name to include. Either I specify a unique filename, which then Proxmox Installer fails to find, or I have to run installs singly and swap out the answer file each time. Dell documentation here: https://www.dell.com/support/manual...e7397f-19d5-4855-b6df-49b1c0cd4986&lang=en-us
Currently the directory structure ends up mounting as:
Is there any way we can specify some kind of prefix, or otherwise make it so proxmox-fetch-answer isn't explicitly looking for /mnt/answer/answer.toml by default? Or leave it as default behavior, but be able to specify either a prefix or loosen it to discovering the first .toml or *answer.toml file?
Might as well include my shoddy rust code in partition.rs that I used for the first attempt. It functioned, but I know I don't know enough Rust to be of any real use:
Currently the directory structure ends up mounting as:
Code:
/mnt
/mnt/answer
/mnt/answer/hostprefix_answer.toml
Is there any way we can specify some kind of prefix, or otherwise make it so proxmox-fetch-answer isn't explicitly looking for /mnt/answer/answer.toml by default? Or leave it as default behavior, but be able to specify either a prefix or loosen it to discovering the first .toml or *answer.toml file?
Might as well include my shoddy rust code in partition.rs that I used for the first attempt. It functioned, but I know I don't know enough Rust to be of any real use:
code_language.rust:
static ANSWER_FILE: &str = "*answer.toml";
static ANSWER_MP: &str = "/mnt/answer";
// FAT can only handle 11 characters, so shorten Automated Installer Source to AIS
static PARTLABEL: &str = "oemdrv";
static DISK_BY_ID_PATH: &str = "/dev/disk/by-label";
pub struct FetchFromPartition;
impl FetchFromPartition {
/// Returns the contents of the answer file
pub fn get_answer() -> Result<String> {
info!("Checking for answer file on partition.");
let mut mount_path = PathBuf::from(mount_proxmoxinst_part()?);
let search = format!("{}{}{}", ANSWER_MP, '/', ANSWER_FILE);
info!("Searching {search:?}");
mount_path.push(ANSWER_FILE);
let files: Result<Vec<_>, _> = glob(mount_path.to_str().unwrap()).expect("Failed to read path!").collect();
let mut files = files.unwrap();
files.sort();
let file = files.first().unwrap();
info!("Using: {:?}", file.display());
let answer = fs::read_to_string(file)
.map_err(|err| format_err!("failed to read answer file - {err}"))?;
info!("Found answer file on partition.");
Ok(answer)
}
}