From d06fa455b770c4b483de8ab72f330db07096540c Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Fri, 7 Jul 2017 17:34:50 -0700 Subject: [PATCH] Small fixes --- client/alloc_runner_health_watcher.go | 14 +++++++++++--- command/deployment_status.go | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/client/alloc_runner_health_watcher.go b/client/alloc_runner_health_watcher.go index c27f6a16d..62378a594 100644 --- a/client/alloc_runner_health_watcher.go +++ b/client/alloc_runner_health_watcher.go @@ -60,6 +60,7 @@ func (r *AllocRunner) watchHealth(ctx context.Context) { l := r.allocBroadcast.Listen() // Create a deadline timer for the health + r.logger.Printf("[DEBUG] client.alloc_watcher: deadline (%v) for alloc %q is at %v", u.HealthyDeadline, alloc.ID, time.Now().Add(u.HealthyDeadline)) deadline := time.NewTimer(u.HealthyDeadline) // Create a healthy timer @@ -91,6 +92,9 @@ func (r *AllocRunner) watchHealth(ctx context.Context) { r.syncStatus() } + // Store whether the last consul checks call was successful or not + consulChecksErr := false + var checks []*api.AgentCheck first := true OUTER: @@ -109,10 +113,14 @@ OUTER: case <-checkCh: newChecks, err := r.consulClient.Checks(alloc) if err != nil { - r.logger.Printf("[WARN] client.alloc_watcher: failed to lookup consul checks for allocation %q: %v", alloc.ID, err) + if !consulChecksErr { + consulChecksErr = true + r.logger.Printf("[WARN] client.alloc_watcher: failed to lookup consul checks for allocation %q: %v", alloc.ID, err) + } + } else { + consulChecksErr = false + checks = newChecks } - - checks = newChecks case <-deadline.C: // We have exceeded our deadline without being healthy. r.logger.Printf("[TRACE] client.alloc_watcher: alloc %q hit healthy deadline", alloc.ID) diff --git a/command/deployment_status.go b/command/deployment_status.go index 736bf5087..858ae4668 100644 --- a/command/deployment_status.go +++ b/command/deployment_status.go @@ -145,7 +145,7 @@ func formatDeployment(d *api.Deployment, uuidLength int) string { // Format the high-level elements high := []string{ fmt.Sprintf("ID|%s", limit(d.ID, uuidLength)), - fmt.Sprintf("Job ID|%s", limit(d.JobID, uuidLength)), + fmt.Sprintf("Job ID|%s", d.JobID), fmt.Sprintf("Job Version|%d", d.JobVersion), fmt.Sprintf("Status|%s", d.Status), fmt.Sprintf("Description|%s", d.StatusDescription),