cli: fix detach handling (#13405)

Fix detach handling for:

- `deployment fail`
- `deployment promote`
- `deployment resume`
- `deployment unblock`
- `job promote`
This commit is contained in:
Derek Strickland 2022-06-21 06:01:23 -04:00 committed by GitHub
parent a97699221c
commit 9de4d7367c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 37 additions and 7 deletions

3
.changelog/13405.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
cli: Fixed remaining bugs where the evaluation ID was not printed when the `-detach` flag was passed
``

View File

@ -132,7 +132,12 @@ func (c *DeploymentFailCommand) Run(args []string) int {
evalCreated := u.EvalID != ""
// Nothing to do
if detach || !evalCreated {
if !evalCreated {
return 0
}
if detach {
c.Ui.Output("Evaluation ID: " + u.EvalID)
return 0
}

View File

@ -140,9 +140,15 @@ func (c *DeploymentPromoteCommand) Run(args []string) int {
return 1
}
// Nothing to do
evalCreated := u.EvalID != ""
if detach || !evalCreated {
// Nothing to do
if !evalCreated {
return 0
}
if detach {
c.Ui.Output("Evaluation ID: " + u.EvalID)
return 0
}

View File

@ -124,7 +124,12 @@ func (c *DeploymentResumeCommand) Run(args []string) int {
evalCreated := u.EvalID != ""
// Nothing to do
if detach || !evalCreated {
if !evalCreated {
return 0
}
if detach {
c.Ui.Output("Evaluation ID: " + u.EvalID)
return 0
}

View File

@ -124,7 +124,12 @@ func (c *DeploymentUnblockCommand) Run(args []string) int {
evalCreated := u.EvalID != ""
// Nothing to do
if detach || !evalCreated {
if !evalCreated {
return 0
}
if detach {
c.Ui.Output("Evaluation ID: " + u.EvalID)
return 0
}

View File

@ -161,9 +161,15 @@ func (c *JobPromoteCommand) Run(args []string) int {
return 1
}
// Nothing to do
evalCreated := u.EvalID != ""
if detach || !evalCreated {
// Nothing to do
if !evalCreated {
return 0
}
if detach {
c.Ui.Output("Evaluation ID: " + u.EvalID)
return 0
}