You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2016/08/01 20:03:27 UTC

mesos git commit: Updated mesos containerizer launch execute() to return 'EXIT_FAILURE'.

Repository: mesos
Updated Branches:
  refs/heads/master 25626fcf8 -> 202e1933c


Updated mesos containerizer launch execute() to return 'EXIT_FAILURE'.

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


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

Branch: refs/heads/master
Commit: 202e1933c592f456420ec1c85fd9a212222d0df9
Parents: 25626fc
Author: Gilbert Song <so...@gmail.com>
Authored: Mon Aug 1 13:03:16 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Mon Aug 1 13:03:16 2016 -0700

----------------------------------------------------------------------
 src/slave/containerizer/mesos/launch.cpp | 46 +++++++++++++--------------
 1 file changed, 23 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/202e1933/src/slave/containerizer/mesos/launch.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/launch.cpp b/src/slave/containerizer/mesos/launch.cpp
index f854a9a..e1cf9d5 100644
--- a/src/slave/containerizer/mesos/launch.cpp
+++ b/src/slave/containerizer/mesos/launch.cpp
@@ -110,7 +110,7 @@ int MesosContainerizerLaunch::execute()
   // Check command line flags.
   if (flags.command.isNone()) {
     cerr << "Flag --command is not specified" << endl;
-    return 1;
+    return EXIT_FAILURE;
   }
 
   bool controlPipeSpecified =
@@ -120,7 +120,7 @@ int MesosContainerizerLaunch::execute()
       (flags.pipe_read.isNone() && flags.pipe_write.isSome())) {
     cerr << "Flag --pipe_read and --pipe_write should either be "
          << "both set or both not set" << endl;
-    return 1;
+    return EXIT_FAILURE;
   }
 
   // Parse the command.
@@ -129,19 +129,19 @@ int MesosContainerizerLaunch::execute()
 
   if (command.isError()) {
     cerr << "Failed to parse the command: " << command.error() << endl;
-    return 1;
+    return EXIT_FAILURE;
   }
 
   // Validate the command.
   if (command.get().shell()) {
     if (!command.get().has_value()) {
       cerr << "Shell command is not specified" << endl;
-      return 1;
+      return EXIT_FAILURE;
     }
   } else {
     if (!command.get().has_value()) {
       cerr << "Executable path is not specified" << endl;
-      return 1;
+      return EXIT_FAILURE;
     }
   }
 
@@ -160,7 +160,7 @@ int MesosContainerizerLaunch::execute()
     Try<Nothing> close = os::close(pipe[1]);
     if (close.isError()) {
       cerr << "Failed to close pipe[1]: " << close.error() << endl;
-      return 1;
+      return EXIT_FAILURE;
     }
 
     // Do a blocking read on the pipe until the parent signals us to continue.
@@ -174,13 +174,13 @@ int MesosContainerizerLaunch::execute()
        // agent restarts across a large/busy cluster.
        cerr << "Failed to synchronize with agent "
             << "(it's probably exited)" << endl;
-       return 1;
+       return EXIT_FAILURE;
     }
 
     close = os::close(pipe[0]);
     if (close.isError()) {
       cerr << "Failed to close pipe[0]: " << close.error() << endl;
-      return 1;
+      return EXIT_FAILURE;
     }
   }
 
@@ -189,7 +189,7 @@ int MesosContainerizerLaunch::execute()
     if (unshare(CLONE_NEWNS) != 0) {
       cerr << "Failed to unshare mount namespace: "
            << os::strerror(errno) << endl;
-      return 1;
+      return EXIT_FAILURE;
     }
   }
 #endif // __linux__
@@ -202,19 +202,19 @@ int MesosContainerizerLaunch::execute()
     foreach (const JSON::Value& value, array.values) {
       if (!value.is<JSON::Object>()) {
         cerr << "Invalid JSON format for flag --commands" << endl;
-        return 1;
+        return EXIT_FAILURE;
       }
 
       Try<CommandInfo> parse = ::protobuf::parse<CommandInfo>(value);
       if (parse.isError()) {
         cerr << "Failed to parse a preparation command: "
              << parse.error() << endl;
-        return 1;
+        return EXIT_FAILURE;
       }
 
       if (!parse.get().has_value()) {
         cerr << "The 'value' of a preparation command is not specified" << endl;
-        return 1;
+        return EXIT_FAILURE;
       }
 
       Try<Subprocess> s = Error("Not launched");
@@ -273,7 +273,7 @@ int MesosContainerizerLaunch::execute()
     if (!_uid.isSome()) {
       cerr << "Failed to get the uid of user '" << flags.user.get() << "': "
            << (_uid.isError() ? _uid.error() : "not found") << endl;
-      return 1;
+      return EXIT_FAILURE;
     }
 
     // No need to change user/groups if the specified user is the same
@@ -283,7 +283,7 @@ int MesosContainerizerLaunch::execute()
       if (!_gid.isSome()) {
         cerr << "Failed to get the gid of user '" << flags.user.get() << "': "
              << (_gid.isError() ? _gid.error() : "not found") << endl;
-        return 1;
+        return EXIT_FAILURE;
       }
 
       Try<vector<gid_t>> _gids = os::getgrouplist(flags.user.get());
@@ -291,7 +291,7 @@ int MesosContainerizerLaunch::execute()
         cerr << "Failed to get the supplementary gids of user '"
              << flags.user.get() << "': "
              << (_gids.isError() ? _gids.error() : "not found") << endl;
-        return 1;
+        return EXIT_FAILURE;
       }
 
       uid = _uid.get();
@@ -317,13 +317,13 @@ int MesosContainerizerLaunch::execute()
     if (realpath.isError()) {
       cerr << "Failed to determine if rootfs is an absolute path: "
            << realpath.error() << endl;
-      return 1;
+      return EXIT_FAILURE;
     } else if (realpath.isNone()) {
       cerr << "Rootfs path does not exist" << endl;
-      return 1;
+      return EXIT_FAILURE;
     } else if (realpath.get() != rootfs.get()) {
       cerr << "Rootfs path is not an absolute path" << endl;
-      return 1;
+      return EXIT_FAILURE;
     }
 
 #ifdef __linux__
@@ -336,7 +336,7 @@ int MesosContainerizerLaunch::execute()
     if (chroot.isError()) {
       cerr << "Failed to enter chroot '" << rootfs.get()
            << "': " << chroot.error();
-      return 1;
+      return EXIT_FAILURE;
     }
   }
 
@@ -349,21 +349,21 @@ int MesosContainerizerLaunch::execute()
     if (setgid.isError()) {
       cerr << "Failed to set gid to " << gid.get()
            << ": " << setgid.error() << endl;
-      return 1;
+      return EXIT_FAILURE;
     }
 
     Try<Nothing> setgroups = os::setgroups(gids, uid);
     if (setgroups.isError()) {
       cerr << "Failed to set supplementary gids: "
            << setgroups.error() << endl;
-      return 1;
+      return EXIT_FAILURE;
     }
 
     Try<Nothing> setuid = os::setuid(uid.get());
     if (setuid.isError()) {
       cerr << "Failed to set uid to " << uid.get()
            << ": " << setuid.error() << endl;
-      return 1;
+      return EXIT_FAILURE;
     }
   }
 #endif // __WINDOWS__
@@ -374,7 +374,7 @@ int MesosContainerizerLaunch::execute()
       cerr << "Failed to chdir into current working directory "
            << "'" << flags.working_directory.get() << "': "
            << chdir.error() << endl;
-      return 1;
+      return EXIT_FAILURE;
     }
   }