5
0
mirror of git://git.proxmox.com/git/proxmox-backup.git synced 2025-01-06 13:18:00 +03:00

SectionConfig::write - return raw string

This commit is contained in:
Dietmar Maurer 2018-11-29 16:47:40 +01:00
parent ae3a512dd9
commit c6ed6cac12

View File

@ -76,7 +76,7 @@ impl SectionConfig {
self.plugins.insert(plugin.type_name.clone(), plugin);
}
pub fn write(&self, filename: &str, config: &SectionConfigData) -> Result<(), Error> {
pub fn write(&self, filename: &str, config: &SectionConfigData) -> Result<String, Error> {
let mut list = LinkedList::new();
@ -128,11 +128,9 @@ impl SectionConfig {
raw += &text;
raw += "\n";
}
println!("CONFIG:\n{}", raw);
}
Ok(())
Ok(raw)
}
pub fn parse(&self, filename: &str, raw: &str) -> Result<SectionConfigData, Error> {
@ -288,8 +286,6 @@ impl SectionConfig {
Some((section_type.into(), section_id.into()))
}
}
@ -333,6 +329,8 @@ lvmthin: local-lvm2
let res = config.parse(filename, &raw);
println!("RES: {:?}", res);
config.write(filename, &res.unwrap());
let raw = config.write(filename, &res.unwrap());
println!("CONFIG:\n{}", raw.unwrap());
}