diff --git a/command/deployment_fail.go b/command/deployment_fail.go index 1b32540ef..fe808feea 100644 --- a/command/deployment_fail.go +++ b/command/deployment_fail.go @@ -81,8 +81,8 @@ func (c *DeploymentFailCommand) Run(args []string) int { } if len(possible) != 0 { - c.Ui.Output(fmt.Sprintf("Prefix matched multiple deployments\n\n%s", formatDeployments(possible, length))) - return 0 + c.Ui.Error(fmt.Sprintf("Prefix matched multiple deployments\n\n%s", formatDeployments(possible, length))) + return 1 } u, _, err := client.Deployments().Fail(deploy.ID, nil) diff --git a/command/deployment_pause.go b/command/deployment_pause.go index 838c9e2e6..bc6deeff7 100644 --- a/command/deployment_pause.go +++ b/command/deployment_pause.go @@ -73,8 +73,8 @@ func (c *DeploymentPauseCommand) Run(args []string) int { } if len(possible) != 0 { - c.Ui.Output(fmt.Sprintf("Prefix matched multiple deployments\n\n%s", formatDeployments(possible, length))) - return 0 + c.Ui.Error(fmt.Sprintf("Prefix matched multiple deployments\n\n%s", formatDeployments(possible, length))) + return 1 } if _, _, err := client.Deployments().Pause(deploy.ID, true, nil); err != nil { diff --git a/command/deployment_promote.go b/command/deployment_promote.go index aa214f2d2..a549ea52c 100644 --- a/command/deployment_promote.go +++ b/command/deployment_promote.go @@ -92,8 +92,8 @@ func (c *DeploymentPromoteCommand) Run(args []string) int { } if len(possible) != 0 { - c.Ui.Output(fmt.Sprintf("Prefix matched multiple deployments\n\n%s", formatDeployments(possible, length))) - return 0 + c.Ui.Error(fmt.Sprintf("Prefix matched multiple deployments\n\n%s", formatDeployments(possible, length))) + return 1 } var u *api.DeploymentUpdateResponse diff --git a/command/deployment_resume.go b/command/deployment_resume.go index ff999aa77..e41ee9e24 100644 --- a/command/deployment_resume.go +++ b/command/deployment_resume.go @@ -79,8 +79,8 @@ func (c *DeploymentResumeCommand) Run(args []string) int { } if len(possible) != 0 { - c.Ui.Output(fmt.Sprintf("Prefix matched multiple deployments\n\n%s", formatDeployments(possible, length))) - return 0 + c.Ui.Error(fmt.Sprintf("Prefix matched multiple deployments\n\n%s", formatDeployments(possible, length))) + return 1 } u, _, err := client.Deployments().Pause(deploy.ID, false, nil) diff --git a/command/deployment_status.go b/command/deployment_status.go index 32302af03..efa086012 100644 --- a/command/deployment_status.go +++ b/command/deployment_status.go @@ -84,8 +84,8 @@ func (c *DeploymentStatusCommand) Run(args []string) int { } if len(possible) != 0 { - c.Ui.Output(fmt.Sprintf("Prefix matched multiple deployments\n\n%s", formatDeployments(possible, length))) - return 0 + c.Ui.Error(fmt.Sprintf("Prefix matched multiple deployments\n\n%s", formatDeployments(possible, length))) + return 1 } if json || len(tmpl) > 0 { diff --git a/command/eval_status.go b/command/eval_status.go index f17107088..bdd6063e6 100644 --- a/command/eval_status.go +++ b/command/eval_status.go @@ -137,8 +137,8 @@ func (c *EvalStatusCommand) Run(args []string) int { failures, ) } - c.Ui.Output(fmt.Sprintf("Prefix matched multiple evaluations\n\n%s", formatList(out))) - return 0 + c.Ui.Error(fmt.Sprintf("Prefix matched multiple evaluations\n\n%s", formatList(out))) + return 1 } // If we are in monitor mode, monitor and exit diff --git a/command/fs.go b/command/fs.go index 01c33e8fb..f383e5610 100644 --- a/command/fs.go +++ b/command/fs.go @@ -160,8 +160,8 @@ func (f *FSCommand) Run(args []string) int { if len(allocs) > 1 { // Format the allocs out := formatAllocListStubs(allocs, verbose, length) - f.Ui.Output(fmt.Sprintf("Prefix matched multiple allocations\n\n%s", out)) - return 0 + f.Ui.Error(fmt.Sprintf("Prefix matched multiple allocations\n\n%s", out)) + return 1 } // Prefix lookup matched a single allocation alloc, _, err := client.Allocations().Info(allocs[0].ID, nil) diff --git a/command/inspect.go b/command/inspect.go index 18812c73e..449ff63d9 100644 --- a/command/inspect.go +++ b/command/inspect.go @@ -97,8 +97,8 @@ func (c *InspectCommand) Run(args []string) int { return 1 } if len(jobs) > 1 && strings.TrimSpace(jobID) != jobs[0].ID { - c.Ui.Output(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs))) - return 0 + c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs))) + return 1 } var version *uint64 diff --git a/command/job_deployments.go b/command/job_deployments.go index c7b102f33..f4f4452fa 100644 --- a/command/job_deployments.go +++ b/command/job_deployments.go @@ -82,8 +82,8 @@ func (c *JobDeploymentsCommand) Run(args []string) int { return 1 } if len(jobs) > 1 && strings.TrimSpace(jobID) != jobs[0].ID { - c.Ui.Output(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs))) - return 0 + c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs))) + return 1 } jobID = jobs[0].ID diff --git a/command/job_history.go b/command/job_history.go index cc4a37ed7..a4b401b20 100644 --- a/command/job_history.go +++ b/command/job_history.go @@ -100,8 +100,8 @@ func (c *JobHistoryCommand) Run(args []string) int { return 1 } if len(jobs) > 1 && strings.TrimSpace(jobID) != jobs[0].ID { - c.Ui.Output(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs))) - return 0 + c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs))) + return 1 } // Prefix lookup matched a single job diff --git a/command/job_promote.go b/command/job_promote.go index 9ef87c1bb..1cfdfb9b5 100644 --- a/command/job_promote.go +++ b/command/job_promote.go @@ -96,8 +96,8 @@ func (c *JobPromoteCommand) Run(args []string) int { return 1 } if len(jobs) > 1 && strings.TrimSpace(jobID) != jobs[0].ID { - c.Ui.Output(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs))) - return 0 + c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs))) + return 1 } jobID = jobs[0].ID diff --git a/command/job_revert.go b/command/job_revert.go index a104b3189..f60ff1404 100644 --- a/command/job_revert.go +++ b/command/job_revert.go @@ -91,8 +91,8 @@ func (c *JobRevertCommand) Run(args []string) int { return 1 } if len(jobs) > 1 && strings.TrimSpace(jobID) != jobs[0].ID { - c.Ui.Output(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs))) - return 0 + c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs))) + return 1 } // Prefix lookup matched a single job diff --git a/command/logs.go b/command/logs.go index 7a86476b2..c7a7aceb9 100644 --- a/command/logs.go +++ b/command/logs.go @@ -136,8 +136,8 @@ func (l *LogsCommand) Run(args []string) int { if len(allocs) > 1 { // Format the allocs out := formatAllocListStubs(allocs, verbose, length) - l.Ui.Output(fmt.Sprintf("Prefix matched multiple allocations\n\n%s", out)) - return 0 + l.Ui.Error(fmt.Sprintf("Prefix matched multiple allocations\n\n%s", out)) + return 1 } // Prefix lookup matched a single allocation alloc, _, err := client.Allocations().Info(allocs[0].ID, nil) diff --git a/command/node_drain.go b/command/node_drain.go index b5f814880..229b99c64 100644 --- a/command/node_drain.go +++ b/command/node_drain.go @@ -124,8 +124,8 @@ func (c *NodeDrainCommand) Run(args []string) int { node.Status) } // Dump the output - c.Ui.Output(fmt.Sprintf("Prefix matched multiple nodes\n\n%s", formatList(out))) - return 0 + c.Ui.Error(fmt.Sprintf("Prefix matched multiple nodes\n\n%s", formatList(out))) + return 1 } // Prefix lookup matched a single node diff --git a/command/node_status.go b/command/node_status.go index 6f9a66ee2..67983533c 100644 --- a/command/node_status.go +++ b/command/node_status.go @@ -231,8 +231,8 @@ func (c *NodeStatusCommand) Run(args []string) int { node.Status) } // Dump the output - c.Ui.Output(fmt.Sprintf("Prefix matched multiple nodes\n\n%s", formatList(out))) - return 0 + c.Ui.Error(fmt.Sprintf("Prefix matched multiple nodes\n\n%s", formatList(out))) + return 1 } // Prefix lookup matched a single node node, _, err := client.Nodes().Info(nodes[0].ID, nil) diff --git a/command/status.go b/command/status.go index a8bc009cc..411dd3c23 100644 --- a/command/status.go +++ b/command/status.go @@ -121,8 +121,8 @@ func (c *StatusCommand) Run(args []string) int { return 1 } if len(jobs) > 1 && strings.TrimSpace(jobID) != jobs[0].ID { - c.Ui.Output(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs))) - return 0 + c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs))) + return 1 } // Prefix lookup matched a single job job, _, err := client.Jobs().Info(jobs[0].ID, nil) diff --git a/command/stop.go b/command/stop.go index d17990d17..374b606c0 100644 --- a/command/stop.go +++ b/command/stop.go @@ -94,8 +94,8 @@ func (c *StopCommand) Run(args []string) int { return 1 } if len(jobs) > 1 && strings.TrimSpace(jobID) != jobs[0].ID { - c.Ui.Output(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs))) - return 0 + c.Ui.Error(fmt.Sprintf("Prefix matched multiple jobs\n\n%s", createStatusListOutput(jobs))) + return 1 } // Prefix lookup matched a single job job, _, err := client.Jobs().Info(jobs[0].ID, nil)