From 385552ddeaf8faeeff99c5733c4e5b7df3e8b046 Mon Sep 17 00:00:00 2001 From: Mathias Lafeldt Date: Mon, 29 Aug 2016 17:43:09 +0200 Subject: [PATCH] Make alloc-status -short work without allocation stats --- command/alloc_status.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/command/alloc_status.go b/command/alloc_status.go index c71dd865b..b25dc97d2 100644 --- a/command/alloc_status.go +++ b/command/alloc_status.go @@ -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)), @@ -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) }