You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by kl...@apache.org on 2018/10/02 09:41:36 UTC
[mesos] 01/02: Added the ability to launch tasks with a TTY
attached to mesos-execute.
This is an automated email from the ASF dual-hosted git repository.
klueska pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 716bb9f65974e4479d9ad794c145aa8293cea203
Author: Kevin Klues <kl...@gmail.com>
AuthorDate: Tue Oct 2 11:40:52 2018 +0200
Added the ability to launch tasks with a TTY attached to mesos-execute.
Review: https://reviews.apache.org/r/68724/
---
src/cli/execute.cpp | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/cli/execute.cpp b/src/cli/execute.cpp
index e0a8fc8..eb5c564 100644
--- a/src/cli/execute.cpp
+++ b/src/cli/execute.cpp
@@ -356,6 +356,11 @@ public:
"and 'protobuf' are valid choices.",
"protobuf");
+ add(&Flags::tty,
+ "tty",
+ "Attach a TTY to the task being launched",
+ false);
+
add(&Flags::partition_aware,
"partition_aware",
"Enable partition-awareness for the framework.",
@@ -390,6 +395,7 @@ public:
Option<string> secret;
string content_type;
bool partition_aware;
+ bool tty;
};
@@ -787,7 +793,8 @@ static Result<ContainerInfo> getContainerInfo(
const Option<string>& dockerImage,
const Option<CapabilityInfo>& effective_capabilities,
const Option<CapabilityInfo>& bounding_capabilities,
- const Option<RLimitInfo>& rlimits)
+ const Option<RLimitInfo>& rlimits,
+ const bool tty)
{
if (containerizer.empty()) {
return None();
@@ -870,6 +877,10 @@ static Result<ContainerInfo> getContainerInfo(
containerInfo.mutable_rlimit_info()->CopyFrom(rlimits.get());
}
+ if (tty) {
+ containerInfo.mutable_tty_info();
+ }
+
return containerInfo;
} else if (containerizer == "docker") {
// 'docker' containerizer only supports 'docker' images.
@@ -892,6 +903,10 @@ static Result<ContainerInfo> getContainerInfo(
}
}
+ if (tty) {
+ return Error("'Docker' containerizer does not allow attaching a TTY");
+ }
+
return containerInfo;
}
@@ -1190,7 +1205,8 @@ int main(int argc, char** argv)
dockerImage,
flags.effective_capabilities,
flags.bounding_capabilities,
- flags.rlimits);
+ flags.rlimits,
+ flags.tty);
if (containerInfo.isError()){
EXIT(EXIT_FAILURE) << containerInfo.error();