You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ne...@apache.org on 2017/05/03 22:38:58 UTC
[3/4] mesos git commit: Checked validity of master and agent version
numbers on startup.
Checked validity of master and agent version numbers on startup.
During startup, we now check that the compiled-in version number of the
master and agent can be parsed by stout's `Version::parse` (i.e., that
`MESOS_VERSION` is valid according to stout's extended variant of the
Semver 2.0.0 format).
Review: https://reviews.apache.org/r/58708
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ecc73219
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ecc73219
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ecc73219
Branch: refs/heads/master
Commit: ecc73219d3ae29993b1b6d7429c51ce7713b801b
Parents: 59180f9
Author: Neil Conway <ne...@gmail.com>
Authored: Mon Mar 6 10:55:07 2017 -0800
Committer: Neil Conway <ne...@gmail.com>
Committed: Wed May 3 15:37:48 2017 -0700
----------------------------------------------------------------------
src/master/main.cpp | 11 +++++++++++
src/slave/main.cpp | 11 +++++++++++
2 files changed, 22 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/ecc73219/src/master/main.cpp
----------------------------------------------------------------------
diff --git a/src/master/main.cpp b/src/master/main.cpp
index 462ed32..06c735e 100644
--- a/src/master/main.cpp
+++ b/src/master/main.cpp
@@ -57,6 +57,7 @@
#include <stout/stringify.hpp>
#include <stout/strings.hpp>
#include <stout/try.hpp>
+#include <stout/version.hpp>
#include "common/build.hpp"
#include "common/http.hpp"
@@ -175,6 +176,16 @@ int main(int argc, char** argv)
return EXIT_FAILURE;
}
+ // Check that master's version has the expected format (SemVer).
+ {
+ Try<Version> version = Version::parse(MESOS_VERSION);
+ if (version.isError()) {
+ EXIT(EXIT_FAILURE)
+ << "Failed to parse Mesos version '" << MESOS_VERSION << "': "
+ << version.error();
+ }
+ }
+
if (flags.ip_discovery_command.isSome() && flags.ip.isSome()) {
EXIT(EXIT_FAILURE) << flags.usage(
"Only one of `--ip` or `--ip_discovery_command` should be specified");
http://git-wip-us.apache.org/repos/asf/mesos/blob/ecc73219/src/slave/main.cpp
----------------------------------------------------------------------
diff --git a/src/slave/main.cpp b/src/slave/main.cpp
index 72b141c..507d599 100644
--- a/src/slave/main.cpp
+++ b/src/slave/main.cpp
@@ -45,6 +45,7 @@
#include <stout/stringify.hpp>
#include <stout/try.hpp>
+#include <stout/version.hpp>
#include "common/build.hpp"
#include "common/http.hpp"
@@ -267,6 +268,16 @@ int main(int argc, char** argv)
return EXIT_FAILURE;
}
+ // Check that agent's version has the expected format (SemVer).
+ {
+ Try<Version> version = Version::parse(MESOS_VERSION);
+ if (version.isError()) {
+ EXIT(EXIT_FAILURE)
+ << "Failed to parse Mesos version '" << MESOS_VERSION << "': "
+ << version.error();
+ }
+ }
+
if (flags.master.isNone() && flags.master_detector.isNone()) {
cerr << flags.usage("Missing required option `--master` or "
"`--master_detector`.") << endl;