Fixed environment overwrite warning to not leak possibly sensitive data. Review: https://reviews.apache.org/r/57763/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/f62f5706 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/f62f5706 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/f62f5706 Branch: refs/heads/1.2.x Commit: f62f57060bb9e1eb25737f98f071f37e88d52b67 Parents: 62a8551 Author: Till Toenshoff <[email protected]> Authored: Fri Mar 24 06:55:46 2017 +0100 Committer: Alexander Rukletsov <[email protected]> Committed: Fri Mar 24 07:12:45 2017 +0100 ---------------------------------------------------------------------- src/slave/containerizer/mesos/launch.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/f62f5706/src/slave/containerizer/mesos/launch.cpp ---------------------------------------------------------------------- diff --git a/src/slave/containerizer/mesos/launch.cpp b/src/slave/containerizer/mesos/launch.cpp index 4dd81b4..2b712a8 100644 --- a/src/slave/containerizer/mesos/launch.cpp +++ b/src/slave/containerizer/mesos/launch.cpp @@ -651,6 +651,10 @@ int MesosContainerizerLaunch::execute() // specified, inherit the environment of the current process. Option<os::raw::Envp> envp; if (launchInfo.has_environment()) { + // TODO(tillt): `Environment::Variable` is not a string anymore, + // consider cleaning this up with the complete rollout of `Secrets`. + // This entire merging should be handled by the solution introduced + // by MESOS-7299. hashmap<string, string> environment; foreach (const Environment::Variable& variable, @@ -658,10 +662,10 @@ int MesosContainerizerLaunch::execute() const string& name = variable.name(); const string& value = variable.value(); - if (environment.contains(name)) { - cout << "Overwriting environment variable '" << name - << "', original: '" << environment[name] - << "', new: '" << value << "'" << endl; + // TODO(tillt): Once we have a solution for MESOS-7292, allow + // logging of values. + if (environment.contains(name) && environment[name] != value) { + cout << "Overwriting environment variable '" << name << "'" << endl; } environment[name] = value;
