diff --git a/state/machine.go b/state/machine.go index d676aac4f975..1a78e6212b1e 100644 --- a/state/machine.go +++ b/state/machine.go @@ -1380,7 +1380,7 @@ func (m *Machine) SetProvisioned( { C: machinesC, Id: m.doc.DocID, - Assert: append(isAliveDoc, bson.DocElem{Name: "nonce", Value: ""}), + Assert: append(notDeadDoc, bson.DocElem{Name: "nonce", Value: ""}), Update: bson.D{{"$set", bson.D{{"nonce", nonce}}}}, }, { C: instanceDataC, @@ -1395,10 +1395,10 @@ func (m *Machine) SetProvisioned( return nil } else if err != txn.ErrAborted { return err - } else if alive, err := isAlive(m.st, machinesC, m.doc.DocID); err != nil { + } else if aliveOrDying, err := isNotDead(m.st, machinesC, m.doc.DocID); err != nil { return err - } else if !alive { - return machineNotAliveErr + } else if !aliveOrDying { + return errDeadOrGone } return fmt.Errorf("already set") }