INNER CODE UNIT · Go
validateKnownGoodSource
uvwt/agentdock · cmd/agentdock-arbiter/main.go:87
func validateKnownGoodSource(transaction updateengine.Transaction) error {
if transaction.Platform == "windows" && transaction.Windows != nil && transaction.Windows.BootstrapMigration {
return nil
}
if transaction.Platform == "darwin" && transaction.MacOS != nil && transaction.MacOS.BootstrapMigration {
return nil
}
current := updateengine.NormalizeVersion(buildinfo.Version)
if current == "" || current != updateengine.NormalizeVersion(transaction.SourceVersion) {
return fmt.Errorf("arbiter version %s is not the known-good source version %s", buildinfo.Version, transaction.SourceVersion)
}
executable, err := os.Executable()
if err != nil {
return fmt.Errorf("resolve arbiter executable: %w", err)
}
executable, _ = filepath.Abs(executable)
expected := expectedSourceArbiter(transaction)
if expected != "" && !samePath(executable, expected) {