feat output artifacts to tmp; add bench & profiling; minor fixes

This commit is contained in:
2026-02-23 02:51:39 -07:00
parent 9649961580
commit f8ced2196c
13 changed files with 2404 additions and 221 deletions

View File

@@ -27,16 +27,15 @@ impl DeviceConfigBundle {
let mut context = Self::merge_context(&spec);
let hostname = Self::get_hostname(&context, &spec);
let base_dir = std::path::Path::new("./tmpl").join(spec.get_layer());
info!("Loading templates for '{hostname}':");
info!("Processing templates for '{hostname}'");
let structure_path = base_dir.join("structure.yaml");
let structure_path = spec.tmplpath.join("structure.yaml");
let structure = tmpl::Structure::from_file(&structure_path)
.map_err(|e| format!("Failed to parse {}: {e}", structure_path.display()))?;
.map_err(|e| format!("Failed to parse {:?}: {e}", structure_path))?;
let mut renderer = tera::Tera::default();
renderer.add_raw_templates(structure.load_template_data(base_dir))?;
dbug!("Processing templates for {hostname}");
renderer.add_raw_templates(structure.load_template_data(&spec.tmplpath))?;
dbug!("Rendering templates for {hostname}");
let mut failures = false;
let mut configs = Vec::new();
@@ -91,9 +90,6 @@ impl DeviceConfigBundle {
info!("Writing Output:");
let device_outpath = std::path::Path::new(&self.spec.outpath).join(self.hostname);
if device_outpath.exists() {
std::fs::remove_dir_all(&device_outpath).ok();
}
std::fs::create_dir_all(&device_outpath).ok();
for variant_configs in self.configs {