| 75 | } |
| 76 | |
| 77 | void Checkable::OnAllConfigLoaded() |
| 78 | { |
| 79 | ObjectImpl<Checkable>::OnAllConfigLoaded(); |
| 80 | |
| 81 | const auto it = boost::range::find(l_DeprecatedCheckCommands, GetCheckCommandRaw()); |
| 82 | if (it != l_DeprecatedCheckCommands.end()) { |
| 83 | static std::mutex warnedSetMutex; |
| 84 | static std::unordered_set<std::string_view> alreadyWarned; |
| 85 | |
| 86 | std::unique_lock lock{warnedSetMutex}; |
| 87 | auto [_, inserted] = alreadyWarned.emplace(*it); |
| 88 | lock.unlock(); |
| 89 | if (inserted) { |
| 90 | Log(LogWarning, "Checkable") |
| 91 | << "CheckCommand '" << GetCheckCommandRaw() << "' used by '" << GetName() << "' (" << GetDebugInfo() |
| 92 | << ") is DEPRECATED and will be removed in v2.18. Further uses of this check command won't be logged."; |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | Endpoint::Ptr endpoint = GetCommandEndpoint(); |
| 97 | |
| 98 | if (endpoint) { |
| 99 | Zone::Ptr checkableZone = static_pointer_cast<Zone>(GetZone()); |
| 100 | |
| 101 | if (checkableZone) { |
| 102 | Zone::Ptr cmdZone = endpoint->GetZone(); |
| 103 | |
| 104 | if (cmdZone != checkableZone && cmdZone->GetParent() != checkableZone) { |
| 105 | BOOST_THROW_EXCEPTION(ValidationError(this, { "command_endpoint" }, |
| 106 | "Command endpoint must be in zone '" + checkableZone->GetName() + "' or in a direct child zone thereof.")); |
| 107 | } |
| 108 | } else { |
| 109 | BOOST_THROW_EXCEPTION(ValidationError(this, { "command_endpoint" }, |
| 110 | "Checkable with command endpoint requires a zone. Please check the troubleshooting documentation.")); |
| 111 | } |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | void Checkable::Start(bool runtimeCreated) |
| 116 | { |