You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2016/03/01 22:39:21 UTC
[2/2] mesos git commit: Windows: Removed `user` launcher flag,
preventing `su`.
Windows: Removed `user` launcher flag, preventing `su`.
`su` does not exist on Windows. Unfortunately, the launcher also depends
on it. In this commit, we remove Windows support for the launcher flag
`user`, which controls whether we use `su` in the launcher. This
allows us to divest ourselves of `su` altogether on Windows.
Review: https://reviews.apache.org/r/43905/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/b9de8c6a
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/b9de8c6a
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/b9de8c6a
Branch: refs/heads/master
Commit: b9de8c6a06f0d0246ea38ab5586de1d0b2478c38
Parents: 546555e
Author: Alex Clemmer <cl...@gmail.com>
Authored: Tue Mar 1 13:33:37 2016 -0800
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Tue Mar 1 13:38:55 2016 -0800
----------------------------------------------------------------------
src/slave/containerizer/mesos/containerizer.cpp | 8 +++++++-
src/slave/containerizer/mesos/launch.cpp | 4 +++-
src/slave/containerizer/mesos/launch.hpp | 2 +-
3 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/b9de8c6a/src/slave/containerizer/mesos/containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/containerizer.cpp b/src/slave/containerizer/mesos/containerizer.cpp
index db3d504..af3ff57 100644
--- a/src/slave/containerizer/mesos/containerizer.cpp
+++ b/src/slave/containerizer/mesos/containerizer.cpp
@@ -1068,10 +1068,16 @@ Future<bool> MesosContainerizerProcess::__launch(
"`chroot` is not supported on Windows, but the `ContainerLaunchInfo` "
"provided a `rootfs` flag to the launcher");
}
+
+ if (!user.isNone()) {
+ return Failure(
+ "`su` is not supported on Windows, but the `ContainerLauncherInfo` "
+ "provided a `user` to the launcher");
+ }
#else
launchFlags.rootfs = rootfs;
-#endif // __WINDOWS__
launchFlags.user = user;
+#endif // __WINDOWS__
launchFlags.pipe_read = pipes[0];
launchFlags.pipe_write = pipes[1];
launchFlags.commands = commands;
http://git-wip-us.apache.org/repos/asf/mesos/blob/b9de8c6a/src/slave/containerizer/mesos/launch.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/launch.cpp b/src/slave/containerizer/mesos/launch.cpp
index 868be60..9fb55aa 100644
--- a/src/slave/containerizer/mesos/launch.cpp
+++ b/src/slave/containerizer/mesos/launch.cpp
@@ -68,11 +68,11 @@ MesosContainerizerLaunch::Flags::Flags()
"The command and sandbox flags are interpreted relative\n"
"to rootfs\n"
"Different platforms may implement 'chroot' differently.");
-#endif // __WINDOWS__
add(&user,
"user",
"The user to change to.");
+#endif // __WINDOWS__
add(&pipe_read,
"pipe_read",
@@ -256,6 +256,7 @@ int MesosContainerizerLaunch::execute()
// same privilege as the mesos-slave.
// NOTE: The requisite user/group information must be present if
// a container root filesystem is used.
+#ifndef __WINDOWS__
if (flags.user.isSome()) {
Try<Nothing> su = os::su(flags.user.get());
if (su.isError()) {
@@ -264,6 +265,7 @@ int MesosContainerizerLaunch::execute()
return 1;
}
}
+#endif // __WINDOWS__
// Determine the current working directory for the executor.
string cwd;
http://git-wip-us.apache.org/repos/asf/mesos/blob/b9de8c6a/src/slave/containerizer/mesos/launch.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/launch.hpp b/src/slave/containerizer/mesos/launch.hpp
index 8fcb58b..c716e03 100644
--- a/src/slave/containerizer/mesos/launch.hpp
+++ b/src/slave/containerizer/mesos/launch.hpp
@@ -39,8 +39,8 @@ public:
Option<std::string> working_directory;
#ifndef __WINDOWS__
Option<std::string> rootfs;
-#endif // __WINDOWS__
Option<std::string> user;
+#endif // __WINDOWS__
Option<int> pipe_read;
Option<int> pipe_write;
Option<JSON::Object> commands; // Additional preparation commands.