mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-24 06:05:01 +02:00
Move CompatUtility::GetHostAlias into DB IDO host object method
This is the only place where this mapping is used.
This commit is contained in:
parent
ab1a2bffcd
commit
70af1a3545
@ -47,8 +47,16 @@ Dictionary::Ptr HostDbObject::GetConfigFields() const
|
|||||||
Dictionary::Ptr fields = new Dictionary();
|
Dictionary::Ptr fields = new Dictionary();
|
||||||
Host::Ptr host = static_pointer_cast<Host>(GetObject());
|
Host::Ptr host = static_pointer_cast<Host>(GetObject());
|
||||||
|
|
||||||
fields->Set("alias", CompatUtility::GetHostAlias(host));
|
/* Compatibility fallback. */
|
||||||
fields->Set("display_name", host->GetDisplayName());
|
String displayName = host->GetDisplayName();
|
||||||
|
|
||||||
|
if (!displayName.IsEmpty()) {
|
||||||
|
fields->Set("alias", displayName);
|
||||||
|
} else {
|
||||||
|
fields->Set("alias", host->GetName());
|
||||||
|
}
|
||||||
|
|
||||||
|
fields->Set("display_name", displayName);
|
||||||
fields->Set("address", host->GetAddress());
|
fields->Set("address", host->GetAddress());
|
||||||
fields->Set("address6", host->GetAddress6());
|
fields->Set("address6", host->GetAddress6());
|
||||||
|
|
||||||
|
@ -96,14 +96,6 @@ String CompatUtility::GetHostStateString(const Host::Ptr& host)
|
|||||||
return Host::StateToString(host->GetState());
|
return Host::StateToString(host->GetState());
|
||||||
}
|
}
|
||||||
|
|
||||||
String CompatUtility::GetHostAlias(const Host::Ptr& host)
|
|
||||||
{
|
|
||||||
if (!host->GetDisplayName().IsEmpty())
|
|
||||||
return host->GetName();
|
|
||||||
else
|
|
||||||
return host->GetDisplayName();
|
|
||||||
}
|
|
||||||
|
|
||||||
int CompatUtility::GetHostNotifyOnDown(const Host::Ptr& host)
|
int CompatUtility::GetHostNotifyOnDown(const Host::Ptr& host)
|
||||||
{
|
{
|
||||||
unsigned long notification_state_filter = GetCheckableNotificationStateFilter(host);
|
unsigned long notification_state_filter = GetCheckableNotificationStateFilter(host);
|
||||||
|
@ -46,7 +46,6 @@ public:
|
|||||||
/* host */
|
/* host */
|
||||||
static int GetHostCurrentState(const Host::Ptr& host);
|
static int GetHostCurrentState(const Host::Ptr& host);
|
||||||
static String GetHostStateString(const Host::Ptr& host);
|
static String GetHostStateString(const Host::Ptr& host);
|
||||||
static String GetHostAlias(const Host::Ptr& host);
|
|
||||||
static int GetHostNotifyOnDown(const Host::Ptr& host);
|
static int GetHostNotifyOnDown(const Host::Ptr& host);
|
||||||
static int GetHostNotifyOnUnreachable(const Host::Ptr& host);
|
static int GetHostNotifyOnUnreachable(const Host::Ptr& host);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user