Adding missing cases for terminal update statues to JobUpdate monitor.

This commit is contained in:
Renan DelValle 2019-01-12 14:12:56 -08:00
parent 65a5d650c0
commit e90eeaf2b4
No known key found for this signature in database
GPG key ID: C240AD6D6F443EC9

View file

@ -24,9 +24,11 @@ import (
) )
const ( const (
UpdateFailed = "update failed" UpdateFailed = "update failed"
RolledBack = "update rolled back" RolledBack = "update rolled back"
Timeout = "timeout" UpdateAborted = "update aborted"
Timeout = "timeout"
UpdateError = "update encountered an error"
) )
type Monitor struct { type Monitor struct {
@ -54,14 +56,20 @@ func (m *Monitor) JobUpdate(updateKey aurora.JobUpdateKey, interval int, timeout
// if we encounter an inactive state and it is not at rolled forward, update failed // if we encounter an inactive state and it is not at rolled forward, update failed
switch status { switch status {
case aurora.JobUpdateStatus_ROLLED_FORWARD: case aurora.JobUpdateStatus_ROLLED_FORWARD:
m.Client.RealisConfig().logger.Println("Update succeeded") m.Client.RealisConfig().logger.Println("update succeeded")
return true, nil return true, nil
case aurora.JobUpdateStatus_FAILED:
m.Client.RealisConfig().logger.Println("Update failed")
return false, errors.New(UpdateFailed)
case aurora.JobUpdateStatus_ROLLED_BACK: case aurora.JobUpdateStatus_ROLLED_BACK:
m.Client.RealisConfig().logger.Println("rolled back") m.Client.RealisConfig().logger.Println(RolledBack)
return false, errors.New(RolledBack) return false, errors.New(RolledBack)
case aurora.JobUpdateStatus_ABORTED:
m.Client.RealisConfig().logger.Println(UpdateAborted)
return false, errors.New(UpdateAborted)
case aurora.JobUpdateStatus_ERROR:
m.Client.RealisConfig().logger.Println(UpdateError)
return false, errors.New(UpdateError)
case aurora.JobUpdateStatus_FAILED:
m.Client.RealisConfig().logger.Println(UpdateFailed)
return false, errors.New(UpdateFailed)
default: default:
return false, nil return false, nil
} }