You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2014/08/06 23:42:38 UTC
git commit: Checked docker validation status code.
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 <tn...@apache.org>
Authored: Wed Aug 6 14:42:11 2014 -0700
Committer: Vinod Kone <vi...@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);