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/06/19 23:01:18 UTC
mesos git commit: Forbid the executor to inherit from slave
environment.
Repository: mesos
Updated Branches:
refs/heads/master d5c17f46a -> ce4b30561
Forbid the executor to inherit from slave environment.
Review: https://reviews.apache.org/r/44498/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ce4b3056
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ce4b3056
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ce4b3056
Branch: refs/heads/master
Commit: ce4b3056164a804bea52810173dbd7a418d12641
Parents: d5c17f4
Author: Gilbert Song <so...@gmail.com>
Authored: Sun Jun 19 16:01:10 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Sun Jun 19 16:01:10 2016 -0700
----------------------------------------------------------------------
docs/configuration.md | 4 ++--
src/slave/containerizer/containerizer.cpp | 11 +++++++----
src/slave/containerizer/containerizer.hpp | 3 +--
src/slave/containerizer/docker.cpp | 3 +--
src/slave/containerizer/docker.hpp | 3 +--
src/slave/flags.cpp | 4 ++--
6 files changed, 14 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/ce4b3056/docs/configuration.md
----------------------------------------------------------------------
diff --git a/docs/configuration.md b/docs/configuration.md
index f0de1bb..e8b357b 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -1285,8 +1285,8 @@ is used for the <code>disk/du</code> isolator. (default: false)
</td>
<td>
JSON object representing the environment variables that should be
-passed to the executor, and thus subsequently task(s). By default the
-executor will inherit the agent's environment variables.
+passed to the executor, and thus subsequently task(s). By default this
+flag is none. Users have to define executor environment explicitly.
Example:
<pre><code>{
"PATH": "/bin:/usr/bin",
http://git-wip-us.apache.org/repos/asf/mesos/blob/ce4b3056/src/slave/containerizer/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/containerizer.cpp b/src/slave/containerizer/containerizer.cpp
index cf7fbb7..ea1473f 100644
--- a/src/slave/containerizer/containerizer.cpp
+++ b/src/slave/containerizer/containerizer.cpp
@@ -345,8 +345,7 @@ map<string, string> executorEnvironment(
const SlaveID& slaveId,
const PID<Slave>& slavePid,
bool checkpoint,
- const Flags& flags,
- bool includeOsEnvironment)
+ const Flags& flags)
{
map<string, string> environment;
@@ -369,8 +368,12 @@ map<string, string> executorEnvironment(
CHECK(value.is<JSON::String>());
environment[key] = value.as<JSON::String>().value;
}
- } else if (includeOsEnvironment) {
- environment = os::environment();
+ }
+
+ // Include a default $PATH if there isn't.
+ if (environment.count("PATH") == 0) {
+ environment["PATH"] =
+ "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";
}
// Set LIBPROCESS_PORT so that we bind to a random free port (since
http://git-wip-us.apache.org/repos/asf/mesos/blob/ce4b3056/src/slave/containerizer/containerizer.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/containerizer.hpp b/src/slave/containerizer/containerizer.hpp
index ff78b4d..b108d68 100644
--- a/src/slave/containerizer/containerizer.hpp
+++ b/src/slave/containerizer/containerizer.hpp
@@ -160,8 +160,7 @@ std::map<std::string, std::string> executorEnvironment(
const SlaveID& slaveId,
const process::PID<Slave>& slavePid,
bool checkpoint,
- const Flags& flags,
- bool includeOsEnvironment = true);
+ const Flags& flags);
} // namespace slave {
} // namespace internal {
http://git-wip-us.apache.org/repos/asf/mesos/blob/ce4b3056/src/slave/containerizer/docker.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/docker.cpp b/src/slave/containerizer/docker.cpp
index 7364f50..a87a87a 100644
--- a/src/slave/containerizer/docker.cpp
+++ b/src/slave/containerizer/docker.cpp
@@ -366,8 +366,7 @@ DockerContainerizerProcess::Container::create(
slaveId,
slavePid,
checkpoint,
- flags,
- false);
+ flags);
launchesExecutorContainer = true;
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/ce4b3056/src/slave/containerizer/docker.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/docker.hpp b/src/slave/containerizer/docker.hpp
index 311dca2..9b0a5a7 100644
--- a/src/slave/containerizer/docker.hpp
+++ b/src/slave/containerizer/docker.hpp
@@ -358,8 +358,7 @@ private:
slaveId,
slavePid,
checkpoint,
- flags,
- false);
+ flags);
}
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/ce4b3056/src/slave/flags.cpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.cpp b/src/slave/flags.cpp
index 69828ae..9582586 100644
--- a/src/slave/flags.cpp
+++ b/src/slave/flags.cpp
@@ -238,8 +238,8 @@ mesos::internal::slave::Flags::Flags()
add(&Flags::executor_environment_variables,
"executor_environment_variables",
"JSON object representing the environment variables that should be\n"
- "passed to the executor, and thus subsequently task(s). By default the\n"
- "executor will inherit the agent's environment variables.\n"
+ "passed to the executor, and thus subsequently task(s). By default this\n"
+ "flag is none. Users have to define executor environment explicitly.\n"
"Example:\n"
"{\n"
" \"PATH\": \"/bin:/usr/bin\",\n"