Repository: mesos
Updated Branches:
  refs/heads/master 162a7f5d8 -> 946219457


Fixed fetcher to ignore unrecognized file names.

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


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

Branch: refs/heads/master
Commit: 94621945785d73672e75c9a80c58593fbd6f4b80
Parents: 162a7f5
Author: Vinod Kone <vinodk...@gmail.com>
Authored: Thu Feb 27 12:34:48 2014 -0800
Committer: Vinod Kone <vi...@twitter.com>
Committed: Thu Feb 27 12:34:48 2014 -0800

----------------------------------------------------------------------
 src/launcher/fetcher.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/94621945/src/launcher/fetcher.cpp
----------------------------------------------------------------------
diff --git a/src/launcher/fetcher.cpp b/src/launcher/fetcher.cpp
index 9c9f07d..5c659a4 100644
--- a/src/launcher/fetcher.cpp
+++ b/src/launcher/fetcher.cpp
@@ -34,7 +34,7 @@ using std::string;
 // Try to extract filename into directory. If filename is recognized as an
 // archive it will be extracted and true returned; if not recognized then false
 // will be returned. An Error is returned if the extraction command fails.
-Try<Nothing> extract(const string& filename, const string& directory)
+Try<bool> extract(const string& filename, const string& directory)
 {
   string command;
   // Extract any .tgz, tar.gz, tar.bz2 or zip files.
@@ -48,7 +48,7 @@ Try<Nothing> extract(const string& filename, const string& 
directory)
   } else if (strings::endsWith(filename, ".zip")) {
     command = "unzip -d '" + directory + "'";
   } else {
-    return Error("Could not extract file with unrecognized extension");
+    return false;
   }
 
   command += " '" + filename + "'";
@@ -61,7 +61,7 @@ Try<Nothing> extract(const string& filename, const string& 
directory)
   LOG(INFO) << "Extracted resource '" << filename
             << "' into '" << directory << "'";
 
-  return Nothing();
+  return true;
 }
 
 
@@ -222,7 +222,7 @@ int main(int argc, char* argv[])
     } else {
       //TODO(idownes): Consider removing the archive once extracted.
       // Try to extract the file if it's recognized as an archive.
-      Try<Nothing> extracted = extract(fetched.get(), directory);
+      Try<bool> extracted = extract(fetched.get(), directory);
       if (extracted.isError()) {
         EXIT(1) << "Failed to extract "
                 << fetched.get() << ":" << extracted.error();

Reply via email to