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.
This commit is contained in:
Michael Schurter
2017-02-09 13:54:33 -08:00
parent a16709ef43
commit c961e751ec

View File

@@ -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)