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/05 23:54:46 UTC

[4/6] 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/5a5dd8a4
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/5a5dd8a4
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/5a5dd8a4

Branch: refs/heads/1.2.x
Commit: 5a5dd8a4edcb52e2227e2a4607b95a7dcc6aa321
Parents: c56851e
Author: Neil Conway <ne...@gmail.com>
Authored: Mon Mar 6 10:55:07 2017 -0800
Committer: Neil Conway <ne...@gmail.com>
Committed: Fri May 5 15:16:38 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/5a5dd8a4/src/master/main.cpp
----------------------------------------------------------------------
diff --git a/src/master/main.cpp b/src/master/main.cpp
index da75fe9..d485a06 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/5a5dd8a4/src/slave/main.cpp
----------------------------------------------------------------------
diff --git a/src/slave/main.cpp b/src/slave/main.cpp
index 31f2b4f..f90aa2f 100644
--- a/src/slave/main.cpp
+++ b/src/slave/main.cpp
@@ -39,6 +39,7 @@
 #include <stout/os.hpp>
 #include <stout/stringify.hpp>
 #include <stout/try.hpp>
+#include <stout/version.hpp>
 
 #include "common/build.hpp"
 #include "common/http.hpp"
@@ -142,6 +143,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;


Re: [4/6] mesos git commit: Checked validity of master and agent version numbers on startup.

Posted by Neil Conway <ne...@gmail.com>.
There was an earlier thread on whether to ignore registration attempts
from pre-1.0 Mesos agents:

https://lists.apache.org/thread.html/f5e15f6d7a3f3b08d29e27455e2e1c801775418a148dded953c568e7@%3Cdev.mesos.apache.org%3E

We didn't explicitly discuss what to do when the compiled-in version
of Mesos is not parseable as SemVer. I'll start a separate thread to
let users know about that change.

Neil


On Mon, May 8, 2017 at 10:25 AM, Vinod Kone <vi...@apache.org> wrote:
> @Neil: Have we sent an email about this change to dev list? This might
> break people who were directly building off source and using a custom
> version number.
>
> On Fri, May 5, 2017 at 4:54 PM, <ne...@apache.org> wrote:
>
>> 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/5a5dd8a4
>> Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/5a5dd8a4
>> Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/5a5dd8a4
>>
>> Branch: refs/heads/1.2.x
>> Commit: 5a5dd8a4edcb52e2227e2a4607b95a7dcc6aa321
>> Parents: c56851e
>> Author: Neil Conway <ne...@gmail.com>
>> Authored: Mon Mar 6 10:55:07 2017 -0800
>> Committer: Neil Conway <ne...@gmail.com>
>> Committed: Fri May 5 15:16:38 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/5a5dd8a4/
>> src/master/main.cpp
>> ----------------------------------------------------------------------
>> diff --git a/src/master/main.cpp b/src/master/main.cpp
>> index da75fe9..d485a06 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/5a5dd8a4/
>> src/slave/main.cpp
>> ----------------------------------------------------------------------
>> diff --git a/src/slave/main.cpp b/src/slave/main.cpp
>> index 31f2b4f..f90aa2f 100644
>> --- a/src/slave/main.cpp
>> +++ b/src/slave/main.cpp
>> @@ -39,6 +39,7 @@
>>  #include <stout/os.hpp>
>>  #include <stout/stringify.hpp>
>>  #include <stout/try.hpp>
>> +#include <stout/version.hpp>
>>
>>  #include "common/build.hpp"
>>  #include "common/http.hpp"
>> @@ -142,6 +143,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;
>>
>>

Re: [4/6] mesos git commit: Checked validity of master and agent version numbers on startup.

Posted by Vinod Kone <vi...@apache.org>.
@Neil: Have we sent an email about this change to dev list? This might
break people who were directly building off source and using a custom
version number.

On Fri, May 5, 2017 at 4:54 PM, <ne...@apache.org> wrote:

> 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/5a5dd8a4
> Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/5a5dd8a4
> Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/5a5dd8a4
>
> Branch: refs/heads/1.2.x
> Commit: 5a5dd8a4edcb52e2227e2a4607b95a7dcc6aa321
> Parents: c56851e
> Author: Neil Conway <ne...@gmail.com>
> Authored: Mon Mar 6 10:55:07 2017 -0800
> Committer: Neil Conway <ne...@gmail.com>
> Committed: Fri May 5 15:16:38 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/5a5dd8a4/
> src/master/main.cpp
> ----------------------------------------------------------------------
> diff --git a/src/master/main.cpp b/src/master/main.cpp
> index da75fe9..d485a06 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/5a5dd8a4/
> src/slave/main.cpp
> ----------------------------------------------------------------------
> diff --git a/src/slave/main.cpp b/src/slave/main.cpp
> index 31f2b4f..f90aa2f 100644
> --- a/src/slave/main.cpp
> +++ b/src/slave/main.cpp
> @@ -39,6 +39,7 @@
>  #include <stout/os.hpp>
>  #include <stout/stringify.hpp>
>  #include <stout/try.hpp>
> +#include <stout/version.hpp>
>
>  #include "common/build.hpp"
>  #include "common/http.hpp"
> @@ -142,6 +143,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;
>
>