Changed the agent's SecretGenerator from Owned to pointer.

This patch updates the agent to hold its `SecretGenerator` as a
raw pointer instead of an `Owned` object. This is more consistent
with the other dependencies injected into the agent, and makes it
easier to test the agent with a mock secret generator.

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


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

Branch: refs/heads/master
Commit: 3d822865e84d997e37e4b37cbe8c58531980a9d4
Parents: 3f9bf37
Author: Greg Mann <[email protected]>
Authored: Sat Mar 25 12:05:45 2017 -0700
Committer: Anand Mazumdar <[email protected]>
Committed: Sat Mar 25 12:05:45 2017 -0700

----------------------------------------------------------------------
 src/slave/slave.cpp | 9 ++++++---
 src/slave/slave.hpp | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/3d822865/src/slave/slave.cpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.cpp b/src/slave/slave.cpp
index 5729849..892b66d 100644
--- a/src/slave/slave.cpp
+++ b/src/slave/slave.cpp
@@ -188,7 +188,8 @@ Slave::Slave(const string& id,
     executorDirectoryMaxAllowedAge(age(0)),
     resourceEstimator(_resourceEstimator),
     qosController(_qosController),
-    authorizer(_authorizer) {}
+    authorizer(_authorizer),
+    secretGenerator(nullptr) {}
 
 
 Slave::~Slave()
@@ -203,6 +204,8 @@ Slave::~Slave()
   }
 
   delete authenticatee;
+
+  delete secretGenerator;
 }
 
 void Slave::signaled(int signal, int uid)
@@ -290,7 +293,7 @@ void Slave::initialize()
 #ifdef USE_SSL_SOCKET
   if (flags.executor_secret_key.isSome()) {
     secretKey = flags.executor_secret_key.get();
-    secretGenerator.reset(new JWTSecretGenerator(secretKey.get()));
+    secretGenerator = new JWTSecretGenerator(secretKey.get());
   }
 
   if (flags.authenticate_http_executors) {
@@ -2185,7 +2188,7 @@ void Slave::__run(
   if (executor == nullptr) {
     executor = framework->addExecutor(executorInfo);
 
-    if (secretGenerator.get()) {
+    if (secretGenerator) {
       generateSecret(framework->id(), executor->id, executor->containerId)
         .onAny(defer(
             self(),

http://git-wip-us.apache.org/repos/asf/mesos/blob/3d822865/src/slave/slave.hpp
----------------------------------------------------------------------
diff --git a/src/slave/slave.hpp b/src/slave/slave.hpp
index 59efa4e..e4f46d4 100644
--- a/src/slave/slave.hpp
+++ b/src/slave/slave.hpp
@@ -901,7 +901,7 @@ private:
 
 protected:
   // Made protected for testing purposes.
-  process::Owned<mesos::SecretGenerator> secretGenerator;
+  mesos::SecretGenerator* secretGenerator;
 };
 
 

Reply via email to