Skip to content

Commit

Permalink
cli: output errors when monitoring deployment (#17348)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgfa29 committed May 30, 2023
1 parent 389dff4 commit 26d3883
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .changelog/17348.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
cli: Output error messages during deployment monitoring
```
12 changes: 6 additions & 6 deletions command/deployment_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ UPDATE:
deploy, meta, err = client.Deployments().Info(deployID, &q)
if err != nil {
d.Append(glint.Layout(glint.Style(
glint.Text(fmt.Sprintf("%s: Error fetching deployment", formatTime(time.Now()))),
glint.Text(fmt.Sprintf("%s: Error fetching deployment: %v", formatTime(time.Now()), err)),
glint.Color("red"),
)).MarginLeft(4), glint.Text(""))
d.RenderFrame()
Expand All @@ -281,7 +281,7 @@ UPDATE:
allocComponent = glint.Layout(
allocComponent,
glint.Style(
glint.Text("Error fetching allocations"),
glint.Text(fmt.Sprintf("Error fetching allocations: %v", err)),
glint.Color("red"),
),
)
Expand Down Expand Up @@ -324,7 +324,7 @@ UPDATE:

if err != nil {
d.Append(glint.Layout(glint.Style(
glint.Text(fmt.Sprintf("%s: Error fetching rollback deployment", formatTime(time.Now()))),
glint.Text(fmt.Sprintf("%s: Error fetching rollback deployment: %v", formatTime(time.Now()), err)),
glint.Color("red"),
)).MarginLeft(4), glint.Text(""))
d.RenderFrame()
Expand Down Expand Up @@ -393,7 +393,7 @@ func (c *DeploymentStatusCommand) defaultMonitor(client *api.Client, deployID st
var meta *api.QueryMeta
deploy, meta, err = client.Deployments().Info(deployID, &q)
if err != nil {
c.Ui.Error(c.Colorize().Color(fmt.Sprintf("%s: Error fetching deployment", formatTime(time.Now()))))
c.Ui.Error(c.Colorize().Color(fmt.Sprintf("%s: Error fetching deployment: %v", formatTime(time.Now()), err)))
return
}

Expand All @@ -405,7 +405,7 @@ func (c *DeploymentStatusCommand) defaultMonitor(client *api.Client, deployID st
info += "\n\n[bold]Allocations[reset]\n"
allocs, _, err := client.Deployments().Allocations(deployID, nil)
if err != nil {
info += "Error fetching allocations"
info += fmt.Sprintf("Error fetching allocations: %v", err)
} else {
info += formatAllocListStubs(allocs, verbose, length)
}
Expand Down Expand Up @@ -435,7 +435,7 @@ func (c *DeploymentStatusCommand) defaultMonitor(client *api.Client, deployID st
c.Ui.Output("")
if err != nil {
c.Ui.Error(c.Colorize().Color(
fmt.Sprintf("%s: Error fetching deployment of previous job version", formatTime(time.Now())),
fmt.Sprintf("%s: Error fetching deployment of previous job version: %v", formatTime(time.Now()), err),
))
return
}
Expand Down

0 comments on commit 26d3883

Please sign in to comment.