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 2016/08/04 16:31:40 UTC

[2/3] mesos git commit: Moved check for '--version' in master and agent 'main.cpp'.

Moved check for '--version' in master and agent 'main.cpp'.

The recent removal of the agent's default `work_dir`
requires us to check for the presence of the `--version`
flag before we check for errors in flag loading; this
patch makes that change, and also moves the
corresponding code in the master for consistency.

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


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

Branch: refs/heads/1.0.x
Commit: 6fe8978c1ce7d29fb9f174735a3e6b8b75884763
Parents: cc86e4b
Author: Greg Mann <gr...@mesosphere.io>
Authored: Thu Aug 4 09:27:07 2016 -0700
Committer: Vinod Kone <vi...@gmail.com>
Committed: Thu Aug 4 09:30:53 2016 -0700

----------------------------------------------------------------------
 src/master/main.cpp | 12 ++++++------
 src/slave/main.cpp  | 10 +++++-----
 2 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/6fe8978c/src/master/main.cpp
----------------------------------------------------------------------
diff --git a/src/master/main.cpp b/src/master/main.cpp
index e202973..ab3dbd6 100644
--- a/src/master/main.cpp
+++ b/src/master/main.cpp
@@ -202,9 +202,9 @@ int main(int argc, char** argv)
 
   Try<flags::Warnings> load = flags.load("MESOS_", argc, argv);
 
-  if (load.isError()) {
-    cerr << flags.usage(load.error()) << endl;
-    return EXIT_FAILURE;
+  if (flags.help) {
+    cout << flags.usage() << endl;
+    return EXIT_SUCCESS;
   }
 
   if (flags.version) {
@@ -212,9 +212,9 @@ int main(int argc, char** argv)
     return EXIT_SUCCESS;
   }
 
-  if (flags.help) {
-    cout << flags.usage() << endl;
-    return EXIT_SUCCESS;
+  if (load.isError()) {
+    cerr << flags.usage(load.error()) << endl;
+    return EXIT_FAILURE;
   }
 
   if (ip_discovery_command.isSome() && ip.isSome()) {

http://git-wip-us.apache.org/repos/asf/mesos/blob/6fe8978c/src/slave/main.cpp
----------------------------------------------------------------------
diff --git a/src/slave/main.cpp b/src/slave/main.cpp
index 6fb5b28..6bb0679 100644
--- a/src/slave/main.cpp
+++ b/src/slave/main.cpp
@@ -187,6 +187,11 @@ int main(int argc, char** argv)
     return EXIT_SUCCESS;
   }
 
+  if (flags.version) {
+    cout << "mesos" << " " << MESOS_VERSION << endl;
+    return EXIT_SUCCESS;
+  }
+
   // TODO(marco): this pattern too should be abstracted away
   // in FlagsBase; I have seen it at least 15 times.
   if (load.isError()) {
@@ -194,11 +199,6 @@ int main(int argc, char** argv)
     return EXIT_FAILURE;
   }
 
-  if (flags.version) {
-    cout << "mesos" << " " << MESOS_VERSION << endl;
-    return EXIT_SUCCESS;
-  }
-
   if (master.isNone() && flags.master_detector.isNone()) {
     cerr << flags.usage("Missing required option `--master` or "
                         "`--master_detector`.") << endl;