refactor(thothctl): share Pi lifecycle lock

This commit is contained in:
2026-08-14 17:36:33 +02:00
parent ae1215dc98
commit e902f758b1
4 changed files with 30 additions and 4 deletions
@@ -246,6 +246,10 @@ func (i Installation) UpdateStatePath() string {
return filepath.Join(i.ControlDirectory(), "update-state.json")
}
func (i Installation) RestartStatePath() string {
return filepath.Join(i.ControlDirectory(), "restart-state.json")
}
// ProjectName is stable for one installation and avoids collisions between different checkouts.
func (i Installation) ProjectName() string {
sum := sha256.Sum256([]byte(i.Path))
@@ -224,6 +224,9 @@ func TestInstallationControlPathsAreIsolatedForDescriptorsSharingOneCheckout(t *
if filepath.Dir(installation.UpdateStatePath()) != filepath.Dir(installation.CurrentImageOverridePath()) {
t.Fatalf("state %q and selector %q do not share one installation control directory", installation.UpdateStatePath(), installation.CurrentImageOverridePath())
}
if got, want := installation.RestartStatePath(), filepath.Join(installation.ControlDirectory(), "restart-state.json"); got != want {
t.Fatalf("RestartStatePath() = %q, want %q", got, want)
}
}
}