mirror of
https://github.com/Icinga/icinga2.git
synced 2026-05-28 04:12:13 -04:00
Add warnings to deprecated features indicating removal in v2.18
This commit is contained in:
parent
7d4af75189
commit
2108300cf8
14 changed files with 102 additions and 5 deletions
|
|
@ -37,6 +37,14 @@ void CompatLogger::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr&)
|
|||
status->Set("compatlogger", new Dictionary(std::move(nodes)));
|
||||
}
|
||||
|
||||
void CompatLogger::OnAllConfigLoaded()
|
||||
{
|
||||
ObjectImpl<CompatLogger>::OnAllConfigLoaded();
|
||||
|
||||
Log(LogWarning, "CompatLogger")
|
||||
<< "This feature is DEPRECATED and will be removed in v2.18.";
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
|
|
@ -47,9 +55,6 @@ void CompatLogger::Start(bool runtimeCreated)
|
|||
Log(LogInformation, "CompatLogger")
|
||||
<< "'" << GetName() << "' started.";
|
||||
|
||||
Log(LogWarning, "CompatLogger")
|
||||
<< "This feature is DEPRECATED and may be removed in future releases. Check the roadmap at https://github.com/Icinga/icinga2/milestones";
|
||||
|
||||
Checkable::OnNewCheckResult.connect([this](const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const MessageOrigin::Ptr&) {
|
||||
CheckResultHandler(checkable, cr);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ public:
|
|||
void ValidateRotationMethod(const Lazy<String>& lvalue, const ValidationUtils& utils) override;
|
||||
|
||||
protected:
|
||||
void OnAllConfigLoaded() override;
|
||||
|
||||
void Start(bool runtimeCreated) override;
|
||||
void Stop(bool runtimeRemoved) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,14 @@ void ExternalCommandListener::StatsFunc(const Dictionary::Ptr& status, const Arr
|
|||
status->Set("externalcommandlistener", new Dictionary(std::move(nodes)));
|
||||
}
|
||||
|
||||
void ExternalCommandListener::OnAllConfigLoaded()
|
||||
{
|
||||
ObjectImpl<ExternalCommandListener>::OnAllConfigLoaded();
|
||||
|
||||
Log(LogWarning, "ExternalCommandListener")
|
||||
<< "This feature is DEPRECATED and will be removed in v2.18.";
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the component.
|
||||
*/
|
||||
|
|
@ -37,8 +45,6 @@ void ExternalCommandListener::Start(bool runtimeCreated)
|
|||
Log(LogInformation, "ExternalCommandListener")
|
||||
<< "'" << GetName() << "' started.";
|
||||
|
||||
Log(LogWarning, "ExternalCommandListener")
|
||||
<< "This feature is DEPRECATED and may be removed in future releases. Check the roadmap at https://github.com/Icinga/icinga2/milestones";
|
||||
#ifndef _WIN32
|
||||
String path = GetCommandPath();
|
||||
m_CommandThread = std::thread([this, path]() { CommandPipeThread(path); });
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ public:
|
|||
static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
|
||||
|
||||
protected:
|
||||
void OnAllConfigLoaded() override;
|
||||
|
||||
void Start(bool runtimeCreated) override;
|
||||
void Stop(bool runtimeRemoved) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -918,6 +918,17 @@ ExpressionResult ApplyExpression::DoEvaluate(ScriptFrame& frame, DebugHint*) con
|
|||
|
||||
ExpressionResult NamespaceExpression::DoEvaluate(ScriptFrame&, DebugHint*) const
|
||||
{
|
||||
DebugInfo adjustedDI = m_DebugInfo;
|
||||
adjustedDI.LastLine = adjustedDI.FirstLine;
|
||||
adjustedDI.LastColumn = 0;
|
||||
|
||||
std::ostringstream oss;
|
||||
ShowCodeLocation(oss, adjustedDI, false);
|
||||
|
||||
Log(LogWarning, "config")
|
||||
<< "User-defined namespaces are deprecated and will be removed in v2.18:\n"
|
||||
<< oss.str();
|
||||
|
||||
Namespace::Ptr ns = new Namespace(true);
|
||||
|
||||
ScriptFrame innerFrame(true, ns);
|
||||
|
|
|
|||
|
|
@ -47,6 +47,14 @@ void IdoMysqlConnection::OnConfigLoaded()
|
|||
std::swap(m_Library, shimLibrary);
|
||||
}
|
||||
|
||||
void IdoMysqlConnection::OnAllConfigLoaded()
|
||||
{
|
||||
ObjectImpl<IdoMysqlConnection>::OnAllConfigLoaded();
|
||||
|
||||
Log(LogWarning, "IdoMysqlConnection")
|
||||
<< "This feature is DEPRECATED and will be removed in v2.18.";
|
||||
}
|
||||
|
||||
void IdoMysqlConnection::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata)
|
||||
{
|
||||
DictionaryData nodes;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ public:
|
|||
|
||||
protected:
|
||||
void OnConfigLoaded() override;
|
||||
void OnAllConfigLoaded() override;
|
||||
|
||||
void Resume() override;
|
||||
void Pause() override;
|
||||
|
||||
|
|
|
|||
|
|
@ -55,6 +55,14 @@ void IdoPgsqlConnection::OnConfigLoaded()
|
|||
std::swap(m_Library, shimLibrary);
|
||||
}
|
||||
|
||||
void IdoPgsqlConnection::OnAllConfigLoaded()
|
||||
{
|
||||
ObjectImpl<IdoPgsqlConnection>::OnAllConfigLoaded();
|
||||
|
||||
Log(LogWarning, "IdoPgsqlConnection")
|
||||
<< "This feature is DEPRECATED and will be removed in v2.18.";
|
||||
}
|
||||
|
||||
void IdoPgsqlConnection::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata)
|
||||
{
|
||||
DictionaryData nodes;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ public:
|
|||
|
||||
protected:
|
||||
void OnConfigLoaded() override;
|
||||
void OnAllConfigLoaded() override;
|
||||
void Resume() override;
|
||||
void Pause() override;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "base/utility.hpp"
|
||||
#include "base/exception.hpp"
|
||||
#include "base/timer.hpp"
|
||||
#include <boost/range/algorithm/find.hpp>
|
||||
#include <boost/thread/once.hpp>
|
||||
|
||||
using namespace icinga;
|
||||
|
|
@ -16,6 +17,23 @@ using namespace icinga;
|
|||
REGISTER_TYPE(Checkable);
|
||||
INITIALIZE_ONCE(&Checkable::StaticInitialize);
|
||||
|
||||
static constexpr std::array l_DeprecatedCheckCommands{
|
||||
"disk-windows",
|
||||
"load-windows",
|
||||
"memory-windows",
|
||||
"network-windows",
|
||||
"perfmon-windows",
|
||||
"ping-windows",
|
||||
"ping4-windows",
|
||||
"ping6-windows",
|
||||
"procs-windows",
|
||||
"service-windows",
|
||||
"swap-windows",
|
||||
"update-windows",
|
||||
"uptime-windows",
|
||||
"users-windows",
|
||||
};
|
||||
|
||||
const std::map<String, int> Checkable::m_FlappingStateFilterMap ({
|
||||
{"OK", FlappingStateFilterOk},
|
||||
{"Warning", FlappingStateFilterWarning},
|
||||
|
|
@ -60,6 +78,21 @@ void Checkable::OnAllConfigLoaded()
|
|||
{
|
||||
ObjectImpl<Checkable>::OnAllConfigLoaded();
|
||||
|
||||
const auto it = boost::range::find(l_DeprecatedCheckCommands, GetCheckCommandRaw());
|
||||
if (it != l_DeprecatedCheckCommands.end()) {
|
||||
static std::mutex warnedSetMutex;
|
||||
static std::unordered_set<std::string_view> alreadyWarned;
|
||||
|
||||
std::unique_lock lock{warnedSetMutex};
|
||||
auto [_, inserted] = alreadyWarned.emplace(*it);
|
||||
lock.unlock();
|
||||
if (inserted) {
|
||||
Log(LogWarning, "Checkable")
|
||||
<< "CheckCommand '" << GetCheckCommandRaw() << "' used by '" << GetName() << "' (" << GetDebugInfo()
|
||||
<< ") is DEPRECATED and will be removed in v2.18. Further uses of this check command won't be logged.";
|
||||
}
|
||||
}
|
||||
|
||||
Endpoint::Ptr endpoint = GetCommandEndpoint();
|
||||
|
||||
if (endpoint) {
|
||||
|
|
|
|||
|
|
@ -42,6 +42,14 @@ void LivestatusListener::StatsFunc(const Dictionary::Ptr& status, const Array::P
|
|||
status->Set("livestatuslistener", new Dictionary(std::move(nodes)));
|
||||
}
|
||||
|
||||
void LivestatusListener::OnAllConfigLoaded()
|
||||
{
|
||||
ObjectImpl<LivestatusListener>::OnAllConfigLoaded();
|
||||
|
||||
Log(LogWarning, "LivestatusListener")
|
||||
<< "This feature is DEPRECATED and will be removed in v2.18.";
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the component.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ public:
|
|||
void ValidateSocketType(const Lazy<String>& lvalue, const ValidationUtils& utils) override;
|
||||
|
||||
protected:
|
||||
void OnAllConfigLoaded() override;
|
||||
|
||||
void Start(bool runtimeCreated) override;
|
||||
void Stop(bool runtimeRemoved) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,14 @@ void ElasticsearchWriter::OnConfigLoaded()
|
|||
}
|
||||
}
|
||||
|
||||
void ElasticsearchWriter::OnAllConfigLoaded()
|
||||
{
|
||||
ObjectImpl<ElasticsearchWriter>::OnAllConfigLoaded();
|
||||
|
||||
Log(LogWarning, "ElasticsearchWriter")
|
||||
<< "This feature is DEPRECATED and will be removed in v2.18.";
|
||||
}
|
||||
|
||||
void ElasticsearchWriter::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata)
|
||||
{
|
||||
DictionaryData nodes;
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ public:
|
|||
|
||||
protected:
|
||||
void OnConfigLoaded() override;
|
||||
void OnAllConfigLoaded() override;
|
||||
void Start(bool runtimeCreated) override;
|
||||
void Resume() override;
|
||||
void Pause() override;
|
||||
|
|
|
|||
Loading…
Reference in a new issue