Skip to content

Commit 8659036

Browse files
committed
fix: loosen requirement on the format.conf file on v7 import
1 parent c15a777 commit 8659036

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

mgmtd/src/db/import_v7.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,12 @@ pub fn import_v7(tx: &rusqlite::Transaction, base_path: &Path) -> Result<()> {
6565
fn check_format_conf(f: &Path) -> Result<()> {
6666
let s = std::fs::read_to_string(f)?;
6767

68-
// No need for fancy parsing, we only allow upgrading from this exact file
69-
if s != "# This file was auto-generated. Do not modify it!
70-
version=5
71-
nodeStates=1
72-
targetStates=1
73-
"
74-
{
75-
bail!("Unexpected format.conf:\n{s}");
68+
if s.matches("version").count() != 1 {
69+
bail!("Unexpected version in format.conf: version field ambiguous or not found");
70+
}
71+
72+
if !s.contains("\nversion=5\n") {
73+
bail!("Unexpected version in format.conf: Expected \"version=5\"");
7674
}
7775

7876
Ok(())

0 commit comments

Comments
 (0)