mirror of
https://github.com/egor-white/zaprett.git
synced 2026-03-22 00:18:13 +05:00
fix extension
This commit is contained in:
@@ -111,11 +111,11 @@ pub async fn start_service() -> anyhow::Result<()> {
|
||||
.into_iter()
|
||||
.map(|m| (m.id().clone(), m))
|
||||
.collect();
|
||||
let strat_modified = prepare_manifests(&start, ®ex_hostlist, &hostlists, &tmp_dir)?;
|
||||
let strat_modified = prepare_manifests(&strat_modified, ®ex_hostlist_exclude, &hostlists_exclude, &tmp_dir)?;
|
||||
let strat_modified = prepare_manifests(&strat_modified, ®ex_ipset, &ipset, &tmp_dir)?;
|
||||
let strat_modified = prepare_manifests(&strat_modified, ®ex_ipset_exclude, &ipset_exclude, &tmp_dir)?;
|
||||
let strat_modified = prepare_manifests(&strat_modified, ®ex_bindir, &bins, &tmp_dir)?;
|
||||
let strat_modified = prepare_manifests(&start, ®ex_hostlist, &hostlists, &tmp_dir, "txt")?;
|
||||
let strat_modified = prepare_manifests(&strat_modified, ®ex_hostlist_exclude, &hostlists_exclude, &tmp_dir, "txt")?;
|
||||
let strat_modified = prepare_manifests(&strat_modified, ®ex_ipset, &ipset, &tmp_dir, "txt")?;
|
||||
let strat_modified = prepare_manifests(&strat_modified, ®ex_ipset_exclude, &ipset_exclude, &tmp_dir, "txt")?;
|
||||
let strat_modified = prepare_manifests(&strat_modified, ®ex_bindir, &bins, &tmp_dir, "bin")?;
|
||||
let strat_modified = regex_hostlists.replace_all(&strat_modified, &hosts);
|
||||
let strat_modified = regex_ipsets.replace_all(&strat_modified, &ipsets);
|
||||
let strat_modified =
|
||||
|
||||
@@ -3,7 +3,7 @@ use regex::Regex;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
pub fn prepare_manifests(input: &str, regex: &Regex, manifests: &HashMap<String, Manifest>, tmp_dir: &Path) -> anyhow::Result<String> {
|
||||
pub fn prepare_manifests(input: &str, regex: &Regex, manifests: &HashMap<String, Manifest>, tmp_dir: &Path, ext: &str) -> anyhow::Result<String> {
|
||||
let required: HashSet<String> = regex.captures_iter(input).map(|c| c[1].to_string()).collect();
|
||||
let mut paths: HashMap<String, PathBuf> = HashMap::new();
|
||||
for id in &required {
|
||||
@@ -11,7 +11,8 @@ pub fn prepare_manifests(input: &str, regex: &Regex, manifests: &HashMap<String,
|
||||
.get(id)
|
||||
.ok_or_else(|| anyhow::anyhow!("Manifest not found: {}", id))?;
|
||||
let path = Path::new(manifest.file());
|
||||
let dst = tmp_dir.join(format!("{}.txt", id));
|
||||
let mut dst = tmp_dir.join(id);
|
||||
dst.set_extension(ext);
|
||||
std::fs::copy(path, &dst)?;
|
||||
paths.insert(id.clone(), dst);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user