You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ya...@apache.org on 2014/07/25 20:48:56 UTC
[1/2] git commit: Made LoadGeneratorFramework a check program instead
of a bin program.
Repository: mesos
Updated Branches:
refs/heads/master d463ef4f9 -> fc6dd3eb0
Made LoadGeneratorFramework a check program instead of a bin program.
Review: https://reviews.apache.org/r/23696
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/fc6dd3eb
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/fc6dd3eb
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/fc6dd3eb
Branch: refs/heads/master
Commit: fc6dd3eb0b4d60384b590644af387d65779417ed
Parents: 43cb534
Author: Jiang Yan Xu <ya...@jxu.me>
Authored: Mon Jul 14 14:56:29 2014 -0700
Committer: Jiang Yan Xu <ya...@jxu.me>
Committed: Fri Jul 25 11:48:24 2014 -0700
----------------------------------------------------------------------
src/Makefile.am | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/fc6dd3eb/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 3cebc52..b660d91 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -974,13 +974,6 @@ clean-python:
PHONY_TARGETS += clean-python
-# Standalone test binaries.
-bin_PROGRAMS += mesos-load-generator-framework
-mesos_load_generator_framework_SOURCES = examples/load_generator_framework.cpp
-mesos_load_generator_framework_CPPFLAGS = $(MESOS_CPPFLAGS)
-mesos_load_generator_framework_LDADD = libmesos.la
-
-
# Test (make check) binaries.
check_PROGRAMS += low-level-scheduler-libprocess
low_level_scheduler_libprocess_SOURCES = examples/low_level_scheduler_libprocess.cpp
@@ -1027,6 +1020,11 @@ balloon_executor_SOURCES = examples/balloon_executor.cpp
balloon_executor_CPPFLAGS = $(MESOS_CPPFLAGS)
balloon_executor_LDADD = libmesos.la
+check_PROGRAMS += load-generator-framework
+load_generator_framework_SOURCES = examples/load_generator_framework.cpp
+load_generator_framework_CPPFLAGS = $(MESOS_CPPFLAGS)
+load_generator_framework_LDADD = libmesos.la
+
check_PROGRAMS += mesos-tests
mesos_tests_SOURCES = \
[2/2] git commit: Allowed LoadGeneratorFramework to read password
from a file.
Posted by ya...@apache.org.
Allowed LoadGeneratorFramework to read password from a file.
Review: https://reviews.apache.org/r/23695
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/43cb5344
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/43cb5344
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/43cb5344
Branch: refs/heads/master
Commit: 43cb53442dfbb0a36e193e504007980d123d074b
Parents: d463ef4
Author: Jiang Yan Xu <ya...@jxu.me>
Authored: Mon Jul 14 15:19:31 2014 -0700
Committer: Jiang Yan Xu <ya...@jxu.me>
Committed: Fri Jul 25 11:48:24 2014 -0700
----------------------------------------------------------------------
src/examples/load_generator_framework.cpp | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/43cb5344/src/examples/load_generator_framework.cpp
----------------------------------------------------------------------
diff --git a/src/examples/load_generator_framework.cpp b/src/examples/load_generator_framework.cpp
index 13ac877..7d94c49 100644
--- a/src/examples/load_generator_framework.cpp
+++ b/src/examples/load_generator_framework.cpp
@@ -28,6 +28,7 @@
#include <stout/numify.hpp>
#include <stout/os.hpp>
#include <stout/stopwatch.hpp>
+#include <stout/strings.hpp>
#include "logging/flags.hpp"
#include "logging/logging.hpp"
@@ -244,7 +245,10 @@ public:
add(&Flags::secret,
"secret",
- "The secret used to authenticate this framework");
+ "The secret used to authenticate this framework.\n"
+ "If the value starts with '/' or 'file://' it will be parsed as the\n"
+ "path to a file containing the secret. Otherwise the string value is\n"
+ "treated as the secret");
add(&Flags::qps,
"qps",
@@ -338,9 +342,26 @@ int main(int argc, char** argv)
EXIT(1) << "Expecting --secret when --authenticate is set";
}
+ string secret = flags.secret.get();
+
+ // If --secret is specified as a file containing the secret,
+ // replace 'secret' with the content.
+ if (strings::startsWith(flags.secret.get(), "/") ||
+ strings::startsWith(flags.secret.get(), "file://")) {
+ const std::string& path =
+ strings::remove(flags.secret.get(), "file://", strings::PREFIX);
+
+ Try<std::string> read = os::read(path);
+ if (read.isError()) {
+ EXIT(1) << "Error reading secret file '" + path + "': " + read.error();
+ }
+
+ secret = read.get();
+ }
+
Credential credential;
credential.set_principal(flags.principal);
- credential.set_secret(flags.secret.get());
+ credential.set_secret(strings::trim(secret));
framework.set_principal(flags.principal);