Adding missing cases for terminal update statues to JobUpdate monitor.
This commit is contained in:
parent
65a5d650c0
commit
e90eeaf2b4
1 changed files with 16 additions and 8 deletions
24
monitors.go
24
monitors.go
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue