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

Function interpretCheckStatusInfo

src/checks/health_checker.cpp:139–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137
138
139static Try<Nothing> interpretCheckStatusInfo(const CheckStatusInfo& result)
140{
141 switch (result.type()) {
142 case CheckInfo::COMMAND: {
143 const int exitCode = result.command().exit_code();
144 if (exitCode != 0) {
145 return Error("Command " + WSTRINGIFY(exitCode));
146 }
147
148 break;
149 }
150 case CheckInfo::HTTP: {
151 const int statusCode = result.http().status_code();
152 if (statusCode < process::http::Status::OK ||
153 statusCode >= process::http::Status::BAD_REQUEST) {
154 return Error(
155 "Unexpected HTTP response code: " +
156 process::http::Status::string(statusCode));
157 }
158
159 break;
160 }
161 case CheckInfo::TCP: {
162 if (!result.tcp().succeeded()) {
163 return Error("TCP connection failed");
164 }
165
166 break;
167 }
168 case CheckInfo::UNKNOWN: {
169 break;
170 }
171 }
172
173 return Nothing();
174}
175
176
177Try<Owned<HealthChecker>> HealthChecker::create(

Callers 1

processCheckResultMethod · 0.85

Calls 6

WSTRINGIFYFunction · 0.85
NothingClass · 0.85
typeMethod · 0.80
commandMethod · 0.80
succeededMethod · 0.80
ErrorFunction · 0.50

Tested by

no test coverage detected