mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-25 23:04:51 +02:00
Macro: Don't break ui if undefined macro given
$object can be an instance of stdClass and cannot call getName(). The name must then be retrieved manually.
This commit is contained in:
parent
b268044efc
commit
41787d91bf
@ -69,9 +69,17 @@ class Macro
|
|||||||
try {
|
try {
|
||||||
$value = $object->$macro;
|
$value = $object->$macro;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$objectName = $object->getName();
|
if ($object instanceof MonitoredObject) {
|
||||||
if ($object instanceof Service) {
|
$objectName = $object instanceof Service
|
||||||
$objectName = $object->getHost()->getName() . '!' . $objectName;
|
? $object->getHost()->getName() . '!' . $object->getName()
|
||||||
|
: $object->getName();
|
||||||
|
} else {
|
||||||
|
$host = 'host_name';
|
||||||
|
$service = 'service_description';
|
||||||
|
|
||||||
|
$objectName = isset($object->$service)
|
||||||
|
? $object->$service . '!' . $object->$host
|
||||||
|
: $object->$host;
|
||||||
}
|
}
|
||||||
|
|
||||||
$value = null;
|
$value = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user