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

Function validateType

src/master/validation.cpp:1103–1155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1101
1102
1103Option<Error> validateType(const ExecutorInfo& executor)
1104{
1105 if (executor.has_container()) {
1106 Option<Error> unionError =
1107 protobuf::validateProtobufUnion(executor.container());
1108 if (unionError.isSome()) {
1109 LOG(WARNING)
1110 << "Executor " << executor.executor_id()
1111 // NOTE: Validation of FrameworkID is done after this validation.
1112 << " of framework '"
1113 << (executor.has_framework_id() ? executor.framework_id().value() : "")
1114 << "' has an invalid protobuf union: "
1115 << unionError.get();
1116 }
1117 }
1118 switch (executor.type()) {
1119 case ExecutorInfo::DEFAULT:
1120 if (executor.has_command()) {
1121 return Error(
1122 "'ExecutorInfo.command' must not be set for 'DEFAULT' executor");
1123 }
1124
1125 if (executor.has_container()) {
1126 if (executor.container().type() != ContainerInfo::MESOS) {
1127 return Error(
1128 "'ExecutorInfo.container.type' must be 'MESOS' for "
1129 "'DEFAULT' executor");
1130 }
1131
1132 if (executor.container().mesos().has_image()) {
1133 return Error(
1134 "'ExecutorInfo.container.mesos.image' must not be set for "
1135 "'DEFAULT' executor");
1136 }
1137 }
1138 break;
1139
1140 case ExecutorInfo::CUSTOM:
1141 if (!executor.has_command()) {
1142 return Error(
1143 "'ExecutorInfo.command' must be set for 'CUSTOM' executor");
1144 }
1145 break;
1146
1147 case ExecutorInfo::UNKNOWN:
1148 // This could happen if a new executor type is introduced in the
1149 // protos but the master doesn't know about it yet (e.g., new
1150 // scheduler launches new type of executor on an old master).
1151 return None();
1152 }
1153
1154 return None();
1155}
1156
1157
1158Option<Error> validateCompatibleExecutorInfo(

Callers 1

TEST_FFunction · 0.85

Calls 7

validateProtobufUnionFunction · 0.85
NoneClass · 0.85
typeMethod · 0.80
ErrorFunction · 0.50
isSomeMethod · 0.45
valueMethod · 0.45
getMethod · 0.45

Tested by 1

TEST_FFunction · 0.68