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:27:25 UTC

[2/2] 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/335001ad
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/335001ad
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/335001ad

Branch: refs/heads/master
Commit: 335001ad26d7eb9f6cde6e2639296fa27cc959be
Parents: 0984bdf
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:27:07 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/335001ad/src/master/main.cpp
----------------------------------------------------------------------
diff --git a/src/master/main.cpp b/src/master/main.cpp
index 0bce1df..4a1a8e7 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/335001ad/src/slave/main.cpp
----------------------------------------------------------------------
diff --git a/src/slave/main.cpp b/src/slave/main.cpp
index c355a3c..8c9d241 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;