Merge "veyron/services/mgmt/node: currently the node manager is updated every time the Update() method is invoked; after this change the node manager is update only when the application envelope has been modified."
diff --git a/services/mgmt/node/impl/const.go b/services/mgmt/node/impl/const.go
index 5615eee..c3c3d7b 100644
--- a/services/mgmt/node/impl/const.go
+++ b/services/mgmt/node/impl/const.go
@@ -1,6 +1,9 @@
 package impl
 
 const (
+	// BinaryEnv is the name of the environment variable that holds the
+	// object name used for obtaining the node manager binary.
+	BinaryEnv = "VEYRON_NM_BINARY"
 	// PreviousEnv is the name of the environment variable that holds
 	// the path to the workspace that contains the previous version of
 	// the node manager.
diff --git a/services/mgmt/node/impl/invoker.go b/services/mgmt/node/impl/invoker.go
index 6cbc12a..f9b4508 100644
--- a/services/mgmt/node/impl/invoker.go
+++ b/services/mgmt/node/impl/invoker.go
@@ -384,6 +384,7 @@
 		return errOperationFailed
 	}
 	output := "#!/bin/bash\n"
+	output += BinaryEnv + "=" + envelope.Binary + " "
 	output += PreviousEnv + "=" + filepath.Dir(path) + " "
 	output += strings.Join(envelope.Env, " ") + " "
 	output += filepath.Join(workspace, "noded") + " "
diff --git a/services/mgmt/node/noded/main.go b/services/mgmt/node/noded/main.go
index b993371..ad8c430 100644
--- a/services/mgmt/node/noded/main.go
+++ b/services/mgmt/node/noded/main.go
@@ -17,6 +17,15 @@
 	"veyron2/vlog"
 )
 
+func generateEnvelope() *application.Envelope {
+	return &application.Envelope{
+		Args:   os.Args,
+		Binary: os.Getenv(impl.BinaryEnv),
+		Env:    os.Environ(),
+		Title:  application.NodeManagerTitle,
+	}
+}
+
 func main() {
 	// TODO(rthellend): Remove the address and protocol flags when the config manager is working.
 	var address, protocol, publishAs string
@@ -38,7 +47,7 @@
 	if err != nil {
 		vlog.Fatalf("Listen(%v, %v) failed: %v", protocol, address, err)
 	}
-	suffix, envelope := "", &application.Envelope{}
+	suffix, envelope := "", generateEnvelope()
 	name := naming.MakeTerminal(naming.JoinAddressName(endpoint.String(), suffix))
 	vlog.VI(0).Infof("Node manager name: %v", name)
 	// TODO(jsimsa): Replace <PreviousEnv> with a command-line flag when