Monitor Instances now returns a tuple so an error can be passed instead of exiting on error. Tuple is: Result of action, error if it exists.

This commit is contained in:
Renan DelValle 2016-10-20 14:39:48 -04:00
parent 8f524eeec5
commit c83e5d268a
2 changed files with 9 additions and 9 deletions

View file

@ -124,7 +124,7 @@ func main() {
fmt.Println(resp.String())
if resp.ResponseCode == aurora.ResponseCode_OK {
if !monitor.Instances(job.JobKey(), job.GetInstanceCount(), 5, 50) {
if ok, err := monitor.Instances(job.JobKey(), job.GetInstanceCount(), 5, 50); !ok || err != nil {
_, err := r.KillJob(job.JobKey())
if err != nil {
fmt.Println(err)
@ -176,7 +176,7 @@ func main() {
}
if resp.ResponseCode == aurora.ResponseCode_OK {
if !monitor.Instances(job.JobKey(), 0, 5, 50) {
if ok, err := monitor.Instances(job.JobKey(), 0, 5, 50); !ok || err != nil {
fmt.Println("Unable to kill all instances of job")
os.Exit(1)
}
@ -226,7 +226,7 @@ func main() {
}
if resp.ResponseCode == aurora.ResponseCode_OK {
if !monitor.Instances(job.JobKey(), job.GetInstanceCount()+numOfInstances, 5, 50) {
if ok, err := monitor.Instances(job.JobKey(), job.GetInstanceCount()+numOfInstances, 5, 50); !ok || err != nil {
fmt.Println("Flexing up failed")
}
}