Merge pull request #2 from njayachandran/master
Included fetch status command to get the maintenance status of a node…
This commit is contained in:
commit
91d962f481
2 changed files with 26 additions and 1 deletions
|
@ -37,6 +37,9 @@ Use "australis [command] --help" for more information about a command.
|
||||||
### Fetching current leader
|
### Fetching current leader
|
||||||
`australis fetch leader [ZK NODE 1] [ZK NODE 2]...[ZK NODE N]`
|
`australis fetch leader [ZK NODE 1] [ZK NODE 2]...[ZK NODE N]`
|
||||||
|
|
||||||
|
### Fetching status/mode of a agent
|
||||||
|
`australis fetch status [HOST 1] [HOST 2]...[HOST N]`
|
||||||
|
|
||||||
### Setting host to DRAIN:
|
### Setting host to DRAIN:
|
||||||
`australis start drain [HOST 1] [HOST 2]...[HOST N]`
|
`australis start drain [HOST 1] [HOST 2]...[HOST N]`
|
||||||
|
|
||||||
|
|
24
cmd/fetch.go
24
cmd/fetch.go
|
@ -3,7 +3,6 @@ package cmd
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/paypal/gorealis"
|
"github.com/paypal/gorealis"
|
||||||
"github.com/paypal/gorealis/gen-go/apache/aurora"
|
"github.com/paypal/gorealis/gen-go/apache/aurora"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -26,6 +25,9 @@ func init() {
|
||||||
// Fetch jobs
|
// Fetch jobs
|
||||||
fetchCmd.AddCommand(fetchJobsCmd)
|
fetchCmd.AddCommand(fetchJobsCmd)
|
||||||
fetchJobsCmd.Flags().StringVarP(role, "role", "r", "", "Aurora Role")
|
fetchJobsCmd.Flags().StringVarP(role, "role", "r", "", "Aurora Role")
|
||||||
|
|
||||||
|
// Fetch Status
|
||||||
|
fetchCmd.AddCommand(fetchStatusCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
var fetchCmd = &cobra.Command{
|
var fetchCmd = &cobra.Command{
|
||||||
|
@ -56,6 +58,13 @@ var fetchJobsCmd = &cobra.Command{
|
||||||
Run: fetchJobs,
|
Run: fetchJobs,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var fetchStatusCmd = &cobra.Command{
|
||||||
|
Use: "status",
|
||||||
|
Short: "Fetch the maintenance status of a node from Aurora",
|
||||||
|
Long: `This command will print the actual status of the mesos agent nodes in Aurora server`,
|
||||||
|
Run: fetchStatus,
|
||||||
|
}
|
||||||
|
|
||||||
func fetchTasks(cmd *cobra.Command, args []string) {
|
func fetchTasks(cmd *cobra.Command, args []string) {
|
||||||
fmt.Printf("Fetching job configuration for [%s/%s/%s] \n", env, role, name)
|
fmt.Printf("Fetching job configuration for [%s/%s/%s] \n", env, role, name)
|
||||||
|
|
||||||
|
@ -84,6 +93,19 @@ func fetchTasks(cmd *cobra.Command, args []string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func fetchStatus(cmd *cobra.Command, args []string) {
|
||||||
|
fmt.Printf("Fetching maintenance status for %v \n", args)
|
||||||
|
_, result, err := client.MaintenanceStatus(args...)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("error: %+v\n", err.Error())
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
for k := range result.Statuses {
|
||||||
|
fmt.Printf("Result: %s:%s\n", k.Host, k.Mode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func fetchLeader(cmd *cobra.Command, args []string) {
|
func fetchLeader(cmd *cobra.Command, args []string) {
|
||||||
fmt.Printf("Fetching leader from %v \n", args)
|
fmt.Printf("Fetching leader from %v \n", args)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue