mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 22:54:57 +02:00
Remove obsolete locks in Livestatus; apply style guide to DB IDO
This commit is contained in:
parent
403ab5c357
commit
50106057bf
@ -51,11 +51,10 @@ Dictionary::Ptr HostDbObject::GetConfigFields() const
|
|||||||
/* Compatibility fallback. */
|
/* Compatibility fallback. */
|
||||||
String displayName = host->GetDisplayName();
|
String displayName = host->GetDisplayName();
|
||||||
|
|
||||||
if (!displayName.IsEmpty()) {
|
if (!displayName.IsEmpty())
|
||||||
fields->Set("alias", displayName);
|
fields->Set("alias", displayName);
|
||||||
} else {
|
else
|
||||||
fields->Set("alias", host->GetName());
|
fields->Set("alias", host->GetName());
|
||||||
}
|
|
||||||
|
|
||||||
fields->Set("display_name", displayName);
|
fields->Set("display_name", displayName);
|
||||||
fields->Set("address", host->GetAddress());
|
fields->Set("address", host->GetAddress());
|
||||||
|
@ -99,12 +99,7 @@ Value CommandsTable::CustomVariableNamesAccessor(const Value& row)
|
|||||||
if (!command)
|
if (!command)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
Dictionary::Ptr vars;
|
Dictionary::Ptr vars = command->GetVars();
|
||||||
|
|
||||||
{
|
|
||||||
ObjectLock olock(command);
|
|
||||||
vars = command->GetVars();
|
|
||||||
}
|
|
||||||
|
|
||||||
Array::Ptr cv = new Array();
|
Array::Ptr cv = new Array();
|
||||||
|
|
||||||
@ -128,12 +123,7 @@ Value CommandsTable::CustomVariableValuesAccessor(const Value& row)
|
|||||||
if (!command)
|
if (!command)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
Dictionary::Ptr vars;
|
Dictionary::Ptr vars = command->GetVars();
|
||||||
|
|
||||||
{
|
|
||||||
ObjectLock olock(command);
|
|
||||||
vars = command->GetVars();
|
|
||||||
}
|
|
||||||
|
|
||||||
Array::Ptr cv = new Array();
|
Array::Ptr cv = new Array();
|
||||||
|
|
||||||
@ -157,12 +147,7 @@ Value CommandsTable::CustomVariablesAccessor(const Value& row)
|
|||||||
if (!command)
|
if (!command)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
Dictionary::Ptr vars;
|
Dictionary::Ptr vars = command->GetVars();
|
||||||
|
|
||||||
{
|
|
||||||
ObjectLock olock(command);
|
|
||||||
vars = command->GetVars();
|
|
||||||
}
|
|
||||||
|
|
||||||
Array::Ptr cv = new Array();
|
Array::Ptr cv = new Array();
|
||||||
|
|
||||||
|
@ -203,12 +203,7 @@ Value ContactsTable::CustomVariableNamesAccessor(const Value& row)
|
|||||||
if (!user)
|
if (!user)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
Dictionary::Ptr vars;
|
Dictionary::Ptr vars = user->GetVars();
|
||||||
|
|
||||||
{
|
|
||||||
ObjectLock olock(user);
|
|
||||||
vars = user->GetVars();
|
|
||||||
}
|
|
||||||
|
|
||||||
Array::Ptr cv = new Array();
|
Array::Ptr cv = new Array();
|
||||||
|
|
||||||
@ -230,12 +225,7 @@ Value ContactsTable::CustomVariableValuesAccessor(const Value& row)
|
|||||||
if (!user)
|
if (!user)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
Dictionary::Ptr vars;
|
Dictionary::Ptr vars = user->GetVars();
|
||||||
|
|
||||||
{
|
|
||||||
ObjectLock olock(user);
|
|
||||||
vars = user->GetVars();
|
|
||||||
}
|
|
||||||
|
|
||||||
Array::Ptr cv = new Array();
|
Array::Ptr cv = new Array();
|
||||||
|
|
||||||
@ -260,12 +250,7 @@ Value ContactsTable::CustomVariablesAccessor(const Value& row)
|
|||||||
if (!user)
|
if (!user)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
Dictionary::Ptr vars;
|
Dictionary::Ptr vars = user->GetVars();
|
||||||
|
|
||||||
{
|
|
||||||
ObjectLock olock(user);
|
|
||||||
vars = user->GetVars();
|
|
||||||
}
|
|
||||||
|
|
||||||
Array::Ptr cv = new Array();
|
Array::Ptr cv = new Array();
|
||||||
|
|
||||||
@ -295,12 +280,7 @@ Value ContactsTable::CVIsJsonAccessor(const Value& row)
|
|||||||
if (!user)
|
if (!user)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
Dictionary::Ptr vars;
|
Dictionary::Ptr vars = user->GetVars();
|
||||||
|
|
||||||
{
|
|
||||||
ObjectLock olock(user);
|
|
||||||
vars = user->GetVars();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!vars)
|
if (!vars)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
@ -1036,12 +1036,7 @@ Value HostsTable::CustomVariableNamesAccessor(const Value& row)
|
|||||||
if (!host)
|
if (!host)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
Dictionary::Ptr vars;
|
Dictionary::Ptr vars = host->GetVars();
|
||||||
|
|
||||||
{
|
|
||||||
ObjectLock olock(host);
|
|
||||||
vars = host->GetVars();
|
|
||||||
}
|
|
||||||
|
|
||||||
Array::Ptr cv = new Array();
|
Array::Ptr cv = new Array();
|
||||||
|
|
||||||
@ -1063,12 +1058,7 @@ Value HostsTable::CustomVariableValuesAccessor(const Value& row)
|
|||||||
if (!host)
|
if (!host)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
Dictionary::Ptr vars;
|
Dictionary::Ptr vars = host->GetVars();
|
||||||
|
|
||||||
{
|
|
||||||
ObjectLock olock(host);
|
|
||||||
vars = host->GetVars();
|
|
||||||
}
|
|
||||||
|
|
||||||
Array::Ptr cv = new Array();
|
Array::Ptr cv = new Array();
|
||||||
|
|
||||||
@ -1093,12 +1083,7 @@ Value HostsTable::CustomVariablesAccessor(const Value& row)
|
|||||||
if (!host)
|
if (!host)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
Dictionary::Ptr vars;
|
Dictionary::Ptr vars = host->GetVars();
|
||||||
|
|
||||||
{
|
|
||||||
ObjectLock olock(host);
|
|
||||||
vars = host->GetVars();
|
|
||||||
}
|
|
||||||
|
|
||||||
Array::Ptr cv = new Array();
|
Array::Ptr cv = new Array();
|
||||||
|
|
||||||
@ -1128,12 +1113,7 @@ Value HostsTable::CVIsJsonAccessor(const Value& row)
|
|||||||
if (!host)
|
if (!host)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
Dictionary::Ptr vars;
|
Dictionary::Ptr vars = host->GetVars();
|
||||||
|
|
||||||
{
|
|
||||||
ObjectLock olock(host);
|
|
||||||
vars = host->GetVars();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!vars)
|
if (!vars)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
@ -1058,12 +1058,7 @@ Value ServicesTable::CustomVariableNamesAccessor(const Value& row)
|
|||||||
if (!service)
|
if (!service)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
Dictionary::Ptr vars;
|
Dictionary::Ptr vars = service->GetVars();
|
||||||
|
|
||||||
{
|
|
||||||
ObjectLock olock(service);
|
|
||||||
vars = service->GetVars();
|
|
||||||
}
|
|
||||||
|
|
||||||
Array::Ptr cv = new Array();
|
Array::Ptr cv = new Array();
|
||||||
|
|
||||||
@ -1085,12 +1080,7 @@ Value ServicesTable::CustomVariableValuesAccessor(const Value& row)
|
|||||||
if (!service)
|
if (!service)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
Dictionary::Ptr vars;
|
Dictionary::Ptr vars = service->GetVars();
|
||||||
|
|
||||||
{
|
|
||||||
ObjectLock olock(service);
|
|
||||||
vars = service->GetVars();
|
|
||||||
}
|
|
||||||
|
|
||||||
Array::Ptr cv = new Array();
|
Array::Ptr cv = new Array();
|
||||||
|
|
||||||
@ -1115,12 +1105,7 @@ Value ServicesTable::CustomVariablesAccessor(const Value& row)
|
|||||||
if (!service)
|
if (!service)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
Dictionary::Ptr vars;
|
Dictionary::Ptr vars = service->GetVars();
|
||||||
|
|
||||||
{
|
|
||||||
ObjectLock olock(service);
|
|
||||||
vars = service->GetVars();
|
|
||||||
}
|
|
||||||
|
|
||||||
Array::Ptr cv = new Array();
|
Array::Ptr cv = new Array();
|
||||||
|
|
||||||
@ -1150,12 +1135,7 @@ Value ServicesTable::CVIsJsonAccessor(const Value& row)
|
|||||||
if (!service)
|
if (!service)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
Dictionary::Ptr vars;
|
Dictionary::Ptr vars = service->GetVars();
|
||||||
|
|
||||||
{
|
|
||||||
ObjectLock olock(service);
|
|
||||||
vars = service->GetVars();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!vars)
|
if (!vars)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user