You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by al...@apache.org on 2016/07/19 16:38:19 UTC

mesos git commit: Cleaned the arguments passed to health checker in docker executor.

Repository: mesos
Updated Branches:
  refs/heads/master 65e821bb5 -> a4892956c


Cleaned the arguments passed to health checker in docker executor.

Docker executor wraps the health check command into `docker exec`
and leverages mesos-health-check binary to actually perform the
check. However prior to this patch there were unnecessary arguments
passed to the binary, including `path` / `argv[0]` mismatch, log
message was misleading as well.

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


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

Branch: refs/heads/master
Commit: a4892956c8179d152ccdc13668b6a00054c3f665
Parents: 65e821b
Author: Alexander Rukletsov <ru...@gmail.com>
Authored: Tue Jul 19 18:37:49 2016 +0200
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Tue Jul 19 18:37:49 2016 +0200

----------------------------------------------------------------------
 src/docker/executor.cpp | 41 +++++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/a4892956/src/docker/executor.cpp
----------------------------------------------------------------------
diff --git a/src/docker/executor.cpp b/src/docker/executor.cpp
index 16260d7..0d1fd65 100644
--- a/src/docker/executor.cpp
+++ b/src/docker/executor.cpp
@@ -501,28 +501,29 @@ private:
       return;
     }
 
-    vector<string> argv;
-    argv.push_back(docker->getPath());
-    argv.push_back("exec");
-    argv.push_back(containerName);
+    vector<string> commandArguments;
+    commandArguments.push_back(docker->getPath());
+    commandArguments.push_back("exec");
+    commandArguments.push_back(containerName);
 
     if (command.shell()) {
-      argv.push_back("sh");
-      argv.push_back("-c");
-      argv.push_back("\"");
-      argv.push_back(command.value());
-      argv.push_back("\"");
+      commandArguments.push_back("sh");
+      commandArguments.push_back("-c");
+      commandArguments.push_back("\"");
+      commandArguments.push_back(command.value());
+      commandArguments.push_back("\"");
     } else {
-      argv.push_back(command.value());
+      commandArguments.push_back(command.value());
 
       foreach (const string& argument, command.arguments()) {
-        argv.push_back(argument);
+        commandArguments.push_back(argument);
       }
     }
 
     healthCheck.mutable_command()->set_shell(true);
     healthCheck.mutable_command()->clear_arguments();
-    healthCheck.mutable_command()->set_value(strings::join(" ", argv));
+    healthCheck.mutable_command()->set_value(
+        strings::join(" ", commandArguments));
 
     JSON::Object json = JSON::protobuf(healthCheck);
 
@@ -530,19 +531,19 @@ private:
 
     // Launch the subprocess using 'exec' style so that quotes can
     // be properly handled.
-    argv.push_back(path);
-    argv.push_back("--executor=" + stringify(self()));
-    argv.push_back("--health_check_json=" + stringify(json));
-    argv.push_back("--task_id=" + task.task_id().value());
+    vector<string> checkerArguments;
+    checkerArguments.push_back(path);
+    checkerArguments.push_back("--executor=" + stringify(self()));
+    checkerArguments.push_back("--health_check_json=" + stringify(json));
+    checkerArguments.push_back("--task_id=" + task.task_id().value());
 
-    const string cmd = strings::join(" ", argv);
-
-    cout << "Launching health check process: " << cmd << endl;
+    cout << "Launching health check process: "
+         << strings::join(" ", checkerArguments) << endl;
 
     Try<Subprocess> healthProcess =
       process::subprocess(
         path,
-        argv,
+        checkerArguments,
         // Intentionally not sending STDIN to avoid health check
         // commands that expect STDIN input to block.
         Subprocess::PATH("/dev/null"),