Using cobra mechanism to restrict number of arguments given to explicit recon.
This commit is contained in:
parent
112f172c64
commit
50ec7cad2c
1 changed files with 1 additions and 6 deletions
|
@ -84,6 +84,7 @@ var forceExplicitReconCmd = &cobra.Command{
|
||||||
and the master responds with the latest state for each task, if possible.
|
and the master responds with the latest state for each task, if possible.
|
||||||
`,
|
`,
|
||||||
Run: explicitRecon,
|
Run: explicitRecon,
|
||||||
|
Args: cobra.MaximumNArgs(1),
|
||||||
}
|
}
|
||||||
|
|
||||||
func explicitRecon(cmd *cobra.Command, args []string) {
|
func explicitRecon(cmd *cobra.Command, args []string) {
|
||||||
|
@ -91,11 +92,6 @@ func explicitRecon(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
fmt.Println("Forcing scheduler to perform an explicit reconciliation with Mesos")
|
fmt.Println("Forcing scheduler to perform an explicit reconciliation with Mesos")
|
||||||
|
|
||||||
if len(args) > 1 || len(args) < 0 {
|
|
||||||
fmt.Println("Only provide a batch size.")
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
switch len(args) {
|
switch len(args) {
|
||||||
case 0:
|
case 0:
|
||||||
fmt.Println("Using default batch size for explicit recon.")
|
fmt.Println("Using default batch size for explicit recon.")
|
||||||
|
@ -122,7 +118,6 @@ func explicitRecon(cmd *cobra.Command, args []string) {
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("Explicit reconciliation started successfully")
|
fmt.Println("Explicit reconciliation started successfully")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var forceImplicitReconCmd = &cobra.Command{
|
var forceImplicitReconCmd = &cobra.Command{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue