mirror of https://github.com/Icinga/icinga2.git
Remove deprecated "DbCat1 | DbCat2" notation for DB IDO categories
This allows for a specific config validation function.
This commit is contained in:
parent
922cb375a9
commit
e0bfe0a5d0
|
@ -779,12 +779,6 @@ by Icinga Web 2 in the table above.
|
|||
In addition to the category flags listed above the `DbCatEverything`
|
||||
flag may be used as a shortcut for listing all flags.
|
||||
|
||||
> **Note**
|
||||
>
|
||||
> The previous way of defining the `categories` attribute e.g.
|
||||
> `DbCatProgramStatus | DbCatState` was deprecated in 2.5 and will
|
||||
> be removed in future versions.
|
||||
|
||||
## <a id="objecttype-idopgsqlconnection"></a> IdoPgSqlConnection
|
||||
|
||||
IDO database adapter for PostgreSQL.
|
||||
|
@ -868,13 +862,6 @@ by Icinga Web 2 in the table above.
|
|||
In addition to the category flags listed above the `DbCatEverything`
|
||||
flag may be used as a shortcut for listing all flags.
|
||||
|
||||
> **Note**
|
||||
>
|
||||
> The previous way of defining the `categories` attribute e.g.
|
||||
> `DbCatProgramStatus | DbCatState` was deprecated in 2.5 and will
|
||||
> be removed in future versions.
|
||||
|
||||
|
||||
## <a id="objecttype-influxdbwriter"></a> InfluxdbWriter
|
||||
|
||||
Writes check result metrics and performance data to a defined InfluxDB host.
|
||||
|
|
|
@ -48,15 +48,7 @@ void DbConnection::OnConfigLoaded(void)
|
|||
|
||||
Value categories = GetCategories();
|
||||
|
||||
//TODO: Remove 'cat1 | cat2' notation in 2.6
|
||||
if (categories.IsNumber()) {
|
||||
SetCategoryFilter(categories);
|
||||
Log(LogWarning, "DbConnection")
|
||||
<< "Specifying flags using '|' for 'categories' for object '" << GetName()
|
||||
<< "' of type '" << GetReflectionType()->GetName() << "'"
|
||||
<< " is deprecated. This functionality will be removed in 2.6.0. Please use an array.";
|
||||
} else
|
||||
SetCategoryFilter(FilterArrayToInt(categories, DbQuery::GetCategoryFilterMap(), DbCatEverything));
|
||||
SetCategoryFilter(FilterArrayToInt(categories, DbQuery::GetCategoryFilterMap(), DbCatEverything));
|
||||
|
||||
if (!GetEnableHa()) {
|
||||
Log(LogDebug, "DbConnection")
|
||||
|
@ -498,6 +490,19 @@ void DbConnection::ValidateFailoverTimeout(double value, const ValidationUtils&
|
|||
BOOST_THROW_EXCEPTION(ValidationError(this, boost::assign::list_of("failover_timeout"), "Failover timeout minimum is 60s."));
|
||||
}
|
||||
|
||||
void DbConnection::ValidateCategories(const Array::Ptr& value, const ValidationUtils& utils)
|
||||
{
|
||||
ObjectImpl<DbConnection>::ValidateCategories(value, utils);
|
||||
|
||||
int filter = FilterArrayToInt(value, DbQuery::GetCategoryFilterMap(), 0);
|
||||
|
||||
if (filter == -1 || (filter & ~(DbCatInvalid | DbCatEverything | DbCatConfig | DbCatState |
|
||||
DbCatAcknowledgement | DbCatComment | DbCatDowntime | DbCatEventHandler | DbCatExternalCommand |
|
||||
DbCatFlapping | DbCatLog | DbCatNotification | DbCatProgramStatus | DbCatRetention |
|
||||
DbCatStateHistory)) != 0)
|
||||
BOOST_THROW_EXCEPTION(ValidationError(this, boost::assign::list_of("categories"), "categories filter is invalid."));
|
||||
}
|
||||
|
||||
void DbConnection::IncreaseQueryCount(void)
|
||||
{
|
||||
double now = Utility::GetTime();
|
||||
|
|
|
@ -77,6 +77,7 @@ public:
|
|||
virtual int GetPendingQueryCount(void) const = 0;
|
||||
|
||||
virtual void ValidateFailoverTimeout(double value, const ValidationUtils& utils) override;
|
||||
virtual void ValidateCategories(const Array::Ptr& value, const ValidationUtils& utils) override;
|
||||
|
||||
protected:
|
||||
virtual void OnConfigLoaded(void) override;
|
||||
|
|
|
@ -35,7 +35,7 @@ abstract class DbConnection : ConfigObject
|
|||
default {{{ return new Dictionary(); }}}
|
||||
};
|
||||
|
||||
[config] Value categories {
|
||||
[config] Array::Ptr categories {
|
||||
default {{{
|
||||
Array::Ptr cat = new Array();
|
||||
cat->Add("DbCatConfig");
|
||||
|
@ -90,10 +90,8 @@ validator DbConnection {
|
|||
Number systemcommands_age;
|
||||
};
|
||||
|
||||
Number categories;
|
||||
Array categories {
|
||||
String "*";
|
||||
Number "*";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue