mirror of
https://github.com/peridotbuild/peridot.git
synced 2024-12-22 02:28:32 +00:00
Add DeleteEntry and make checksum mismatch non retryable error
This commit is contained in:
parent
41e39e07b1
commit
9ce1b9b229
@ -98,7 +98,11 @@ func (w *Worker) SetEntryIDFromRPM(entry string, uri string, checksumSha256 stri
|
||||
return nil, errors.Wrap(err, "failed to hash resource")
|
||||
}
|
||||
if hex.EncodeToString(hash.Sum(nil)) != checksumSha256 {
|
||||
return nil, errors.New("checksum does not match")
|
||||
return nil, temporal.NewNonRetryableApplicationError(
|
||||
"checksum does not match",
|
||||
"checksumDoesNotMatch",
|
||||
errors.New("client submitted a checksum that does not match the resource"),
|
||||
)
|
||||
}
|
||||
|
||||
// Read the RPM headers
|
||||
@ -177,3 +181,15 @@ func (w *Worker) SetWorkerLastCheckinTime(workerID string) error {
|
||||
|
||||
return base.Q[mothership_db.Worker](w.db).U(wrk)
|
||||
}
|
||||
|
||||
func (w *Worker) DeleteEntry(name string) error {
|
||||
err := base.Q[mothership_db.Entry](w.db).F("name", name).Delete()
|
||||
if err != nil {
|
||||
if err == sql.ErrNoRows {
|
||||
return nil
|
||||
}
|
||||
return errors.Wrap(err, "failed to delete entry")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user