MCPcopy Create free account
hub / github.com/apache/mesos / initialize

Method initialize

src/slave/slave.cpp:279–997  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277
278
279void Slave::initialize()
280{
281 LOG(INFO) << "Mesos agent started on " << string(self()).substr(5);
282 LOG(INFO) << "Flags at startup: " << flags;
283
284 if (self().address.ip.isLoopback()) {
285 LOG(WARNING) << "\n**************************************************\n"
286 << "Agent bound to loopback interface!"
287 << " Cannot communicate with remote master(s)."
288 << " You might want to set '--ip' flag to a routable"
289 << " IP address.\n"
290 << "**************************************************";
291 }
292
293 if (flags.registration_backoff_factor > REGISTER_RETRY_INTERVAL_MAX) {
294 EXIT(EXIT_FAILURE)
295 << "Invalid value '" << flags.registration_backoff_factor << "'"
296 << " for --registration_backoff_factor:"
297 << " Must be less than " << REGISTER_RETRY_INTERVAL_MAX;
298 }
299
300 authenticateeName = flags.authenticatee;
301
302 // Load credential for agent authentication with the master.
303 if (flags.credential.isSome()) {
304 Result<Credential> _credential =
305 credentials::readCredential(flags.credential.get());
306 if (_credential.isError()) {
307 EXIT(EXIT_FAILURE) << _credential.error() << " (see --credential flag)";
308 } else if (_credential.isNone()) {
309 EXIT(EXIT_FAILURE)
310 << "Empty credential file '" << flags.credential.get() << "'"
311 << " (see --credential flag)";
312 } else {
313 credential = _credential.get();
314 LOG(INFO) << "Agent using credential for: "
315 << credential->principal();
316 }
317 }
318
319 Option<Credentials> httpCredentials;
320 if (flags.http_credentials.isSome()) {
321 Result<Credentials> credentials =
322 credentials::read(flags.http_credentials.get());
323 if (credentials.isError()) {
324 EXIT(EXIT_FAILURE)
325 << credentials.error() << " (see --http_credentials flag)";
326 } else if (credentials.isNone()) {
327 EXIT(EXIT_FAILURE)
328 << "Credentials file must contain at least one credential"
329 << " (see --http_credentials flag)";
330 }
331 httpCredentials = credentials.get();
332 }
333
334 string httpAuthenticators;
335 if (flags.http_authenticators.isSome()) {
336 httpAuthenticators = flags.http_authenticators.get();

Callers 3

registeredMethod · 0.45
_recoverOperationsMethod · 0.45
createMethod · 0.45

Calls 15

readCredentialFunction · 0.85
permissionsFunction · 0.85
splitFunction · 0.85
deferFunction · 0.85
NanosecondsClass · 0.85
logRequestFunction · 0.85
ForbiddenClass · 0.85
ServiceUnavailableClass · 0.85
logResponseFunction · 0.85
authorizeLogAccessFunction · 0.85
getLogFileFunction · 0.85

Tested by

no test coverage detected