mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 00:34:05 +02:00
show/activitylog: fallback rendering for hosts...
...with obsolete parents, that have been removed in the meantime
This commit is contained in:
parent
081ea72497
commit
c0a8c49d4f
@ -77,6 +77,10 @@ class ShowController extends ActionController
|
|||||||
protected function getObjectConfig($object)
|
protected function getObjectConfig($object)
|
||||||
{
|
{
|
||||||
$config = new IcingaConfig($this->db());
|
$config = new IcingaConfig($this->db());
|
||||||
|
if ($object->isExternal()) {
|
||||||
|
$object->object_type = 'object';
|
||||||
|
}
|
||||||
|
|
||||||
$object->renderToConfig($config);
|
$object->renderToConfig($config);
|
||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
|
@ -110,6 +110,7 @@ class IcingaHost extends IcingaObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$hostVars = array();
|
$hostVars = array();
|
||||||
|
|
||||||
if ($connection !== null) {
|
if ($connection !== null) {
|
||||||
foreach ($connection->fetchDistinctHostVars() as $var) {
|
foreach ($connection->fetchDistinctHostVars() as $var) {
|
||||||
if ($var->datatype) {
|
if ($var->datatype) {
|
||||||
@ -167,6 +168,10 @@ class IcingaHost extends IcingaObject
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->getRenderingZone($config) === self::RESOLVE_ERROR) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->getResolvedProperty('has_agent') !== 'y') {
|
if ($this->getResolvedProperty('has_agent') !== 'y') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@ use Exception;
|
|||||||
|
|
||||||
abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
||||||
{
|
{
|
||||||
|
const RESOLVE_ERROR = '(unable to resolve)';
|
||||||
|
|
||||||
protected $keyName = 'object_name';
|
protected $keyName = 'object_name';
|
||||||
|
|
||||||
protected $autoincKeyName = 'id';
|
protected $autoincKeyName = 'id';
|
||||||
@ -1295,9 +1297,17 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||||||
|
|
||||||
public function getRenderingZone(IcingaConfig $config = null)
|
public function getRenderingZone(IcingaConfig $config = null)
|
||||||
{
|
{
|
||||||
if ($zoneId = $this->getResolvedProperty('zone_id')) {
|
if ($this->hasUnresolvedRelatedProperty('zone_id')) {
|
||||||
// Config has a lookup cache, is faster:
|
return $this->zone;
|
||||||
return $config->getZoneName($zoneId);
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ($zoneId = $this->getResolvedProperty('zone_id')) {
|
||||||
|
// Config has a lookup cache, is faster:
|
||||||
|
return $config->getZoneName($zoneId);
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return self::RESOLVE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->prefersGlobalZone()) {
|
if ($this->prefersGlobalZone()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user