mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vinodk...@apache.org
Subject git commit: Checked docker validation status code.
Date Wed, 06 Aug 2014 21:42:38 GMT
Repository: mesos
Updated Branches:
  refs/heads/master 53401fdfa -> ea46a7070


Checked docker validation status code.

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


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

Branch: refs/heads/master
Commit: ea46a7070237c1ea7d0529a222246c7269d2e57b
Parents: 53401fd
Author: Timothy Chen <tnachen@apache.org>
Authored: Wed Aug 6 14:42:11 2014 -0700
Committer: Vinod Kone <vinodkone@gmail.com>
Committed: Wed Aug 6 14:42:11 2014 -0700

----------------------------------------------------------------------
 src/docker/docker.cpp | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/ea46a707/src/docker/docker.cpp
----------------------------------------------------------------------
diff --git a/src/docker/docker.cpp b/src/docker/docker.cpp
index ee9c882..1cba381 100644
--- a/src/docker/docker.cpp
+++ b/src/docker/docker.cpp
@@ -124,24 +124,25 @@ Try<Docker> Docker::create(const string& path, bool validate)
   Try<Subprocess> s = subprocess(
       cmd,
       Subprocess::PATH("/dev/null"),
-      Subprocess::PIPE(),
+      Subprocess::PATH("/dev/null"),
       Subprocess::PATH("/dev/null"));
 
   if (s.isError()) {
     return Error(s.error());
   }
 
-  Try<Nothing> nonblock = os::nonblock(s.get().out().get());
-  if (nonblock.isError()) {
-    return Error("Failed to accept nonblock stdout:" + nonblock.error());
-  }
-
-  Future<string> output = io::read(s.get().out().get());
+  Future<Option<int> > status = s.get().status();
 
-  if (!output.await(Seconds(5))) {
+  if (!status.await(Seconds(5))) {
     return Error("Docker info failed with time out");
-  } else if (output.isFailed()) {
-    return Error("Docker info failed: " + output.failure());
+  } else if (status.isFailed()) {
+    return Error("Docker info failed: " + status.failure());
+  } else if (!status.get().isSome() || status.get().get() != 0) {
+    string msg = "Docker info failed to execute";
+    if (status.get().isSome()) {
+      msg += ", exited with status (" + WSTRINGIFY(status.get().get()) + ")";
+    }
+    return Error(msg);
   }
 
   return Docker(path);


Mime
View raw message