From c961e751ec91f568765ebcdbb2f218da0eef227f Mon Sep 17 00:00:00 2001 From: Michael Schurter Date: Thu, 9 Feb 2017 13:54:33 -0800 Subject: [PATCH] Fix upgrade path for created resources This *might* be a fix for #2295 -- I've been unable to reproduce the bug. However, this guard seems wise regardless. I should never be overwriting an intialized created resources with a nil. --- client/task_runner.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/task_runner.go b/client/task_runner.go index 6f183359c..88f2e2a0b 100644 --- a/client/task_runner.go +++ b/client/task_runner.go @@ -247,9 +247,13 @@ func (r *TaskRunner) RestoreState() error { } r.artifactsDownloaded = snap.ArtifactDownloaded r.taskDirBuilt = snap.TaskDirBuilt - r.createdResources = snap.CreatedResources r.payloadRendered = snap.PayloadRendered + // Pre-0.5.3 state snapshots won't have created resources + if snap.CreatedResources != nil { + r.createdResources = snap.CreatedResources + } + if err := r.setTaskEnv(); err != nil { return fmt.Errorf("client: failed to create task environment for task %q in allocation %q: %v", r.task.Name, r.alloc.ID, err)