Host Maintenance monitor now returns a list of hosts that did enter the desired mode(s) instead of a boolean. This means the monitor can see a partial success.
This commit is contained in:
parent
430764f025
commit
3111b358fc
3 changed files with 56 additions and 28 deletions
|
@ -513,12 +513,21 @@ func main() {
|
|||
}
|
||||
|
||||
// Monitor change to DRAINING and DRAINED mode
|
||||
_, err = monitor.HostMaintenance(
|
||||
nontransitioned, err := monitor.HostMaintenance(
|
||||
hosts,
|
||||
[]aurora.MaintenanceMode{aurora.MaintenanceMode_DRAINED, aurora.MaintenanceMode_DRAINING},
|
||||
5,
|
||||
10)
|
||||
if err != nil {
|
||||
|
||||
// Check whether the call was partially successful
|
||||
if len(nontransitioned) != 0 {
|
||||
fmt.Println("Partial success:")
|
||||
for host, _ := range nontransitioned {
|
||||
fmt.Printf("Host %s did not transtion into desired mode(s)\n", host)
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Printf("error: %+v\n", err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
@ -539,15 +548,24 @@ func main() {
|
|||
}
|
||||
|
||||
// Monitor change to DRAINING and DRAINED mode
|
||||
_, err = monitor.HostMaintenance(
|
||||
nontransitioned, err := monitor.HostMaintenance(
|
||||
hosts,
|
||||
[]aurora.MaintenanceMode{aurora.MaintenanceMode_NONE},
|
||||
5,
|
||||
10)
|
||||
if err != nil {
|
||||
// Check whether the call was partially successful
|
||||
if len(nontransitioned) != 0 {
|
||||
fmt.Println("Partial success:")
|
||||
for host, _ := range nontransitioned {
|
||||
fmt.Printf("Host %s did not transtion into desired mode(s)\n", host)
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Printf("error: %+v\n", err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
fmt.Print(result.String())
|
||||
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue