Icinga/icingaweb2

Broken UI if service/host_icon_image is set to a variable that doesn't exist

Opened this issue · 0 comments

Describe the bug

icingacli monitoring list services --format csv --columns "host,service,service_icon_image":
"example_host","example_service1",""
"example_host","example_service2","$host_icon_image$"
"example_host","example_service3","/internal_url/icon_host.png"

To Reproduce

  1. Create a generic-service template with its icon_image set to $host_icon_image$.
  2. Create some services which have a service_icon_image set to an icinga-icon or an url which overwrites the generic-service's icon_image (those services cause no problems). In the example it's example_service1 and example_service3
  3. Create service that have set the host's icon_image (they break the overview). In the example its example_service2

The stacktrace in the icingaweb log is:

Error in /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Object/Macro.php:72 with message: Call to undefined method stdClass::getName()
#0 /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Object/Macro.php(45): Icinga\Module\Monitoring\Object\Macro::resolveMacro(String, Object(stdClass))
#1 /usr/share/icingaweb2/modules/monitoring/application/views/helpers/IconImage.php(58): Icinga\Module\Monitoring\Object\Macro::resolveMacros(String, Object(stdClass))
#2 /usr/share/icingaweb2/modules/monitoring/application/views/scripts/list/services.phtml(74): Zend_View_Helper_IconImage->service(Object(stdClass))
#3 /usr/share/php/Icinga/Web/View.php(235): include(String)
#4 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/View/Abstract.php(886): Icinga\Web\View->_run(String)
#5 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Action/Helper/ViewRenderer.php(910): Zend_View_Abstract->render(NULL)
#6 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Action/Helper/ViewRenderer.php(931): Zend_Controller_Action_Helper_ViewRenderer->renderScript(String, NULL)
#7 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Action/Helper/ViewRenderer.php(970): Zend_Controller_Action_Helper_ViewRenderer->render()
#8 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Action/HelperBroker.php(277): Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
#9 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Action.php(527): Zend_Controller_Action_HelperBroker->notifyPostDispatch()
#10 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch(String)
#11 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Front.php(954): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#12 /usr/share/php/Icinga/Application/Web.php(294): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#13 /usr/share/php/Icinga/Application/webrouter.php(105): Icinga\Application\Web->dispatch()
#14 /usr/share/icingaweb2/public/index.php(4): require_once(String)
#15 {main}

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Your Environment

  • Icinga Web 2 version and modules (System - About): 2.12.1

Additional context

Reference:
dae7bf4
dae7bf4#commitcomment-136484066