From 88c7e043488cc881330994e26ba4265c209d6446 Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Tue, 15 Nov 2016 10:03:06 -0800 Subject: [PATCH] Check for Ephemeral Disk being nil --- client/client.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/client.go b/client/client.go index 761d92233..9a4e47d1b 100644 --- a/client/client.go +++ b/client/client.go @@ -1393,7 +1393,7 @@ func (c *Client) runAllocs(update *allocUpdates) { // previous allocation var prevAllocDir *allocdir.AllocDir tg := add.Job.LookupTaskGroup(add.TaskGroup) - if tg != nil && tg.EphemeralDisk.Sticky == true && ar != nil { + if tg != nil && tg.EphemeralDisk != nil && tg.EphemeralDisk.Sticky == true && ar != nil { prevAllocDir = ar.GetAllocDir() } @@ -1432,7 +1432,7 @@ func (c *Client) blockForRemoteAlloc(alloc *structs.Allocation) { } // Wait for the remote previous alloc to be terminal if the alloc is sticky - if tg.EphemeralDisk.Sticky { + if tg.EphemeralDisk != nil && tg.EphemeralDisk.Sticky { c.logger.Printf("[DEBUG] client: blocking alloc %q for previous allocation %q", alloc.ID, alloc.PreviousAllocation) // Block until the previous allocation migrates to terminal state prevAlloc, err := c.waitForAllocTerminal(alloc.PreviousAllocation) @@ -1509,7 +1509,7 @@ func (c *Client) migrateRemoteAllocDir(alloc *structs.Allocation, allocID string // Skip migration of data if the ephemeral disk is not sticky or // migration is turned off. - if !tg.EphemeralDisk.Sticky || !tg.EphemeralDisk.Migrate { + if tg.EphemeralDisk == nil || !tg.EphemeralDisk.Sticky || !tg.EphemeralDisk.Migrate { return nil, nil }