lucifer: send needs_deploy state for failed deployment.

BUG=chromium:1025040
TEST=unittest

Change-Id: Idd131be5fb9f1cc3b50184338c7adede74559b33
diff --git a/src/lucifer/cmd/lucifer/deploytask.go b/src/lucifer/cmd/lucifer/deploytask.go
index 995a449..7fd5cc5 100644
--- a/src/lucifer/cmd/lucifer/deploytask.go
+++ b/src/lucifer/cmd/lucifer/deploytask.go
@@ -18,6 +18,7 @@
 	"lucifer/autotest"
 	"lucifer/autotest/atutil"
 	"lucifer/autotest/dutprep"
+	"lucifer/event"
 	"lucifer/flagx"
 	"lucifer/osutil"
 )
@@ -78,6 +79,8 @@
 	ac := res.apiClient()
 	for _, a := range dutprep.SortActions(c.actions) {
 		if err := c.runDeployAction(ctx, ac, a); err != nil {
+			fmt.Fprintf(os.Stderr, "deploy failed: %s\n", err)
+			sendHostStatus(ctx, ac, []string{c.host}, event.HostNeedsDeploy)
 			return err
 		}
 	}
diff --git a/src/lucifer/event/event.go b/src/lucifer/event/event.go
index a7ecc76..952206b 100644
--- a/src/lucifer/event/event.go
+++ b/src/lucifer/event/event.go
@@ -70,6 +70,9 @@
 	// handler may mark the host as dirty if the handler is
 	// tracking host dirtiness.
 	HostRunning Event = "host_running"
+	// NeedsDeploy indicates that the host fails the deploy task and needs
+	// to be deployed again.
+	HostNeedsDeploy Event = "host_needs_deploy"
 )
 
 // SendWithMsg sends an event with a message by printing to stdout.