You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2016/11/29 19:41:27 UTC

[8/9] mesos git commit: Moved the default PATH setting to containerizer.

Moved the default PATH setting to containerizer.

Currently, it is set as part of the executor environment. This is not
ideal because isolators might choose to set environment variables for
the contianer. We should set the default PATH in the last step (right
before launch) if it does not exist.

Mesos containerizer launch helper already does default PATH setting
right before launching the container. This patch did the same in
Docker containerizer, and remove the default PATH setting when
generating the executor environment.

Review: https://reviews.apache.org/r/54102


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/93eacdb1
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/93eacdb1
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/93eacdb1

Branch: refs/heads/master
Commit: 93eacdb16d2622f862522e51a60ab1b91d1d66da
Parents: 418433d
Author: Jie Yu <yu...@gmail.com>
Authored: Sat Nov 26 22:44:49 2016 -0800
Committer: Jie Yu <yu...@gmail.com>
Committed: Tue Nov 29 11:40:50 2016 -0800

----------------------------------------------------------------------
 src/slave/containerizer/docker.cpp |  5 +++++
 src/slave/slave.cpp                | 10 ----------
 2 files changed, 5 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/93eacdb1/src/slave/containerizer/docker.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/docker.cpp b/src/slave/containerizer/docker.cpp
index 5ce4667..28b487a 100644
--- a/src/slave/containerizer/docker.cpp
+++ b/src/slave/containerizer/docker.cpp
@@ -1449,6 +1449,11 @@ Future<pid_t> DockerContainerizerProcess::launchExecutorProcess(
     environment["GLOG_v"] = glog.get();
   }
 
+  if (environment.count("PATH") == 0) {
+    environment["PATH"] =
+      "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";
+  }
+
   vector<string> argv;
   argv.push_back("mesos-docker-executor");
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/93eacdb1/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 1273b0f..7eb4503 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -6957,16 +6957,6 @@ map<string, string> executorEnvironment(
     }
   }
 
-#ifndef __WINDOWS__
-  // Include a default $PATH if there isn't.
-  // On Windows, we ensure the path is set by checking the system environment.
-  // See `createProcessEnvironment` in `process/windows/subprocess.hpp`.
-  if (environment.count("PATH") == 0) {
-    environment["PATH"] =
-      "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";
-  }
-#endif // __WINDOWS__
-
   // Set LIBPROCESS_PORT so that we bind to a random free port (since
   // this might have been set via --port option). We do this before
   // the environment variables below in case it is included.