Skip to content

Commit

Permalink
Make alloc-status -short work without allocation stats
Browse files Browse the repository at this point in the history
  • Loading branch information
mlafeldt committed Aug 29, 2016
1 parent b813362 commit 385552d
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions command/alloc_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,6 @@ func (c *AllocStatusCommand) Run(args []string) int {
return 0
}

var statsErr error
var stats *api.AllocResourceUsage
stats, statsErr = client.Allocations().Stats(alloc, nil)
if statsErr != nil {
c.Ui.Output("")
c.Ui.Error(fmt.Sprintf("couldn't retrieve stats (HINT: ensure Client.Advertise.HTTP is set): %v", statsErr))
}

// Format the allocation data
basic := []string{
fmt.Sprintf("ID|%s", limit(alloc.ID, length)),
Expand All @@ -236,6 +228,13 @@ func (c *AllocStatusCommand) Run(args []string) int {
if short {
c.shortTaskStatus(alloc)
} else {
var statsErr error
var stats *api.AllocResourceUsage
stats, statsErr = client.Allocations().Stats(alloc, nil)
if statsErr != nil {
c.Ui.Output("")
c.Ui.Error(fmt.Sprintf("couldn't retrieve stats (HINT: ensure Client.Advertise.HTTP is set): %v", statsErr))
}
c.outputTaskDetails(alloc, stats, displayStats)
}

Expand Down

0 comments on commit 385552d

Please sign in to comment.