Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: output errors when monitoring deployment #17348

Merged
merged 2 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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