hive-c0re: pass build_logs the parent dir, not the broker.sqlite file
Every other Coordinator opener takes the broker.sqlite path and derives its parent internally; BuildLogs alone wants a directory. Passing the file path tripped create_dir_all on an existing file (File exists os error 17) and blocked c0re boot.
This commit is contained in:
parent
252d8bf9af
commit
7cc2690717
2 changed files with 10 additions and 5 deletions
|
|
@ -131,10 +131,10 @@ pub struct BuildLogs {
|
|||
}
|
||||
|
||||
impl BuildLogs {
|
||||
pub fn open(db_path: &Path) -> Result<Self> {
|
||||
std::fs::create_dir_all(db_path)
|
||||
.with_context(|| format!("create build_logs db parent {}", db_path.display()))?;
|
||||
let path = db_path.join("build_logs.sqlite");
|
||||
pub fn open(db_dir: &Path) -> Result<Self> {
|
||||
std::fs::create_dir_all(db_dir)
|
||||
.with_context(|| format!("create build_logs db parent {}", db_dir.display()))?;
|
||||
let path = db_dir.join("build_logs.sqlite");
|
||||
let conn = Connection::open(&path)
|
||||
.with_context(|| format!("open build_logs db {}", path.display()))?;
|
||||
conn.execute_batch(SCHEMA)
|
||||
|
|
|
|||
|
|
@ -220,8 +220,13 @@ impl Coordinator {
|
|||
let questions = OperatorQuestions::open(db_path).context("open operator_questions")?;
|
||||
let scheduled_prompts = crate::scheduled_prompts::ScheduledPrompts::open(db_path)
|
||||
.context("open scheduled_prompts")?;
|
||||
// BuildLogs wants a directory (it picks its own `build_logs.sqlite`
|
||||
// file under it); every other opener here takes the sibling
|
||||
// sqlite-file path itself. Derive the dir from `db_path`'s
|
||||
// parent so the two shapes line up.
|
||||
let build_logs_dir = db_path.parent().unwrap_or_else(|| Path::new("."));
|
||||
let build_logs = Arc::new(
|
||||
crate::build_logs::BuildLogs::open(db_path).context("open build_logs")?,
|
||||
crate::build_logs::BuildLogs::open(build_logs_dir).context("open build_logs")?,
|
||||
);
|
||||
// Install the process-wide handle so `lifecycle::run` /
|
||||
// `lifecycle::prebuild_toplevel` can write without us having
|
||||
|
|
|
|||
Loading…
Reference in a new issue