You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2014/03/10 07:41:36 UTC

git commit: Add --version flag to mesos master and slave.

Repository: mesos
Updated Branches:
  refs/heads/master 8a09ecff0 -> e7dc7b965


Add --version flag to mesos master and slave.

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


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

Branch: refs/heads/master
Commit: e7dc7b9656f3079433a3240236b2012e94135a8b
Parents: 8a09ecf
Author: Nikita Vetoshkin <ni...@gmail.com>
Authored: Sun Mar 9 23:41:26 2014 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Sun Mar 9 23:41:26 2014 -0700

----------------------------------------------------------------------
 src/master/flags.hpp |  6 ++++++
 src/master/main.cpp  | 12 ++++++++++++
 src/slave/flags.hpp  |  6 ++++++
 src/slave/main.cpp   | 12 ++++++++++++
 4 files changed, 36 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/e7dc7b96/src/master/flags.hpp
----------------------------------------------------------------------
diff --git a/src/master/flags.hpp b/src/master/flags.hpp
index 159b2de..012eb5a 100644
--- a/src/master/flags.hpp
+++ b/src/master/flags.hpp
@@ -35,6 +35,11 @@ class Flags : public logging::Flags
 public:
   Flags()
   {
+    add(&Flags::version,
+        "version",
+        "Show version and exit.",
+        false);
+
     add(&Flags::hostname,
         "hostname",
         "The hostname the master should advertise in ZooKeeper.\n"
@@ -120,6 +125,7 @@ public:
         "Path could be of the form 'file:///path/to/file' or '/path/to/file'");
   }
 
+  bool version;
   Option<std::string> hostname;
   bool root_submissions;
   std::string work_dir;

http://git-wip-us.apache.org/repos/asf/mesos/blob/e7dc7b96/src/master/main.cpp
----------------------------------------------------------------------
diff --git a/src/master/main.cpp b/src/master/main.cpp
index 4c74a1b..a99fb64 100644
--- a/src/master/main.cpp
+++ b/src/master/main.cpp
@@ -59,6 +59,7 @@ using namespace zookeeper;
 using mesos::MasterInfo;
 
 using std::cerr;
+using std::cout;
 using std::endl;
 using std::string;
 
@@ -72,6 +73,12 @@ void usage(const char* argv0, const flags::FlagsBase& flags)
 }
 
 
+void version()
+{
+  cout << "mesos" << " " << MESOS_VERSION << endl;
+}
+
+
 int main(int argc, char** argv)
 {
   GOOGLE_PROTOBUF_VERIFY_VERSION;
@@ -111,6 +118,11 @@ int main(int argc, char** argv)
     exit(1);
   }
 
+  if (flags.version) {
+    version();
+    exit(0);
+  }
+
   if (help) {
     usage(argv[0], flags);
     exit(1);

http://git-wip-us.apache.org/repos/asf/mesos/blob/e7dc7b96/src/slave/flags.hpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.hpp b/src/slave/flags.hpp
index e4d98a5..c9a627b 100644
--- a/src/slave/flags.hpp
+++ b/src/slave/flags.hpp
@@ -43,6 +43,11 @@ public:
         "The hostname the slave should report.\n"
         "If left unset, system hostname will be used (recommended).");
 
+    add(&Flags::version,
+        "version",
+        "Show version and exit.",
+        false);
+
     // TODO(benh): Is there a way to specify units for the resources?
     add(&Flags::resources,
         "resources",
@@ -193,6 +198,7 @@ public:
 #endif
   }
 
+  bool version;
   Option<std::string> hostname;
   Option<std::string> resources;
   std::string isolation;

http://git-wip-us.apache.org/repos/asf/mesos/blob/e7dc7b96/src/slave/main.cpp
----------------------------------------------------------------------
diff --git a/src/slave/main.cpp b/src/slave/main.cpp
index a498a6a..8c2b70c 100644
--- a/src/slave/main.cpp
+++ b/src/slave/main.cpp
@@ -41,6 +41,7 @@ using namespace mesos::internal::slave;
 using mesos::SlaveInfo;
 
 using std::cerr;
+using std::cout;
 using std::endl;
 using std::string;
 
@@ -54,6 +55,12 @@ void usage(const char* argv0, const flags::FlagsBase& flags)
 }
 
 
+void version()
+{
+  cout << "mesos" << " " << MESOS_VERSION << endl;
+}
+
+
 int main(int argc, char** argv)
 {
   GOOGLE_PROTOBUF_VERIFY_VERSION;
@@ -96,6 +103,11 @@ int main(int argc, char** argv)
     EXIT(1);
   }
 
+  if (flags.version) {
+    version();
+    exit(0);
+  }
+
   if (master.isNone()) {
     EXIT(1) << "Missing required option --master";
   }