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

Method generateSecret

src/slave/slave.cpp:3701–3734  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3699
3700
3701Future<Option<Secret>> Slave::generateSecret(
3702 const FrameworkID& frameworkId,
3703 const ExecutorID& executorId,
3704 const ContainerID& containerId)
3705{
3706 if (!secretGenerator) {
3707 return None();
3708 }
3709
3710 Principal principal(
3711 Option<string>::none(),
3712 {
3713 {"fid", frameworkId.value()},
3714 {"eid", executorId.value()},
3715 {"cid", containerId.value()}
3716 });
3717
3718 return secretGenerator->generate(principal)
3719 .then([](const Secret& secret) -> Future<Option<Secret>> {
3720 Option<Error> error = common::validation::validateSecret(secret);
3721
3722 if (error.isSome()) {
3723 return Failure(
3724 "Failed to validate generated secret: " + error->message);
3725 } else if (secret.type() != Secret::VALUE) {
3726 return Failure(
3727 "Expecting generated secret to be of VALUE type instead of " +
3728 stringify(secret.type()) + " type; " +
3729 "only VALUE type secrets are supported at this time");
3730 }
3731
3732 return secret;
3733 });
3734}
3735
3736
3737// Launches an executor which was previously created.

Callers

nothing calls this directly

Calls 9

NoneClass · 0.85
validateSecretFunction · 0.85
FailureClass · 0.85
typeMethod · 0.80
stringifyFunction · 0.50
valueMethod · 0.45
thenMethod · 0.45
generateMethod · 0.45
isSomeMethod · 0.45

Tested by

no test coverage detected