Skip to content

Custom Hostvar type array produce exception in logfile #2960

@tomabg

Description

@tomabg

Describe the bug

A clear and concise description of what the issue is.

To Reproduce

Provide a link to a live example, or an unambiguous set of steps to reproduce this issue. Include configuration, logs, etc. to reproduce, if relevant.

  1. assigning a custom var of Type array to a host like in this example the exampleuser : vars : { Number_of_Linux_Cores: 2, OS: "Linux", notify_users: [ "exampleuser" ], teams_notifications: "enabled" }
  2. click this host in Icingaweb2 and observe /var/log/icingaweb2/icingaweb2.log
  3. exception below is produced

###########################
2025-02-12T13:43:53+01:00 - ERROR - TypeError in /usr/share/icingaweb2/modules/director/library/Director/ProvidedHook/Icingadb/CustomVarRenderer.php:256 with message: Illegal offset type in isset or empty
#0 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Hook/CustomVarRendererHook.php(85): Icinga\Module\Director\ProvidedHook\Icingadb\CustomVarRenderer->renderCustomVarValue()
Icinga/icingaweb2#1 [internal function]: Icinga\Module\Icingadb\Hook\CustomVarRendererHook::Icinga\Module\Icingadb\Hook{closure}()
Icinga/icingaweb2#2 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Widget/Detail/CustomVarTable.php(104): call_user_func()
Icinga/icingaweb2#3 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Widget/Detail/CustomVarTable.php(252): Icinga\Module\Icingadb\Widget\Detail\CustomVarTable->renderVar()
Icinga/icingaweb2#4 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(344): Icinga\Module\Icingadb\Widget\Detail\CustomVarTable->assemble()
Icinga/icingaweb2#5 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(566): ipl\Html\HtmlDocument->ensureAssembled()
Icinga/icingaweb2#6 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(390): ipl\Html\HtmlDocument->render()
Icinga/icingaweb2#7 /usr/share/icinga-php/ipl/vendor/ipl/html/src/BaseHtmlElement.php(297): ipl\Html\HtmlDocument->renderUnwrapped()
Icinga/icingaweb2#8 /usr/share/icinga-php/ipl/vendor/ipl/html/src/BaseHtmlElement.php(365): ipl\Html\BaseHtmlElement->renderContent()
Icinga/icingaweb2#9 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(568): ipl\Html\BaseHtmlElement->renderUnwrapped()
Icinga/icingaweb2#10 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(390): ipl\Html\HtmlDocument->render()
Icinga/icingaweb2#11 /usr/share/icinga-php/ipl/vendor/ipl/html/src/BaseHtmlElement.php(297): ipl\Html\HtmlDocument->renderUnwrapped()
Icinga/icingaweb2#12 /usr/share/icinga-php/ipl/vendor/ipl/html/src/BaseHtmlElement.php(365): ipl\Html\BaseHtmlElement->renderContent()
Icinga/icingaweb2#13 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(568): ipl\Html\BaseHtmlElement->renderUnwrapped()
Icinga/icingaweb2#14 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(390): ipl\Html\HtmlDocument->render()
Icinga/icingaweb2#15 /usr/share/icinga-php/ipl/vendor/ipl/html/src/BaseHtmlElement.php(297): ipl\Html\HtmlDocument->renderUnwrapped()
Icinga/icingaweb2#16 /usr/share/icinga-php/ipl/vendor/ipl/html/src/BaseHtmlElement.php(365): ipl\Html\BaseHtmlElement->renderContent()
Icinga/icingaweb2#17 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(568): ipl\Html\BaseHtmlElement->renderUnwrapped()
Icinga/icingaweb2#18 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(390): ipl\Html\HtmlDocument->render()
Icinga/icingaweb2#19 /usr/share/icinga-php/ipl/vendor/ipl/html/src/HtmlDocument.php(568): ipl\Html\HtmlDocument->renderUnwrapped()
Icinga/icingaweb2#20 /usr/share/icinga-php/ipl/vendor/ipl/web/src/Compat/ViewRenderer.php(62): ipl\Html\HtmlDocument->render()
Icinga/icingaweb2#21 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Action/Helper/ViewRenderer.php(970): ipl\Web\Compat\ViewRenderer->render()
Icinga/icingaweb2#22 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Action/HelperBroker.php(277): Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
Icinga/icingaweb2#23 /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Web/Controller.php(484): Zend_Controller_Action_HelperBroker->notifyPostDispatch()
Icinga/icingaweb2#24 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Icinga\Module\Icingadb\Web\Controller->dispatch()
Icinga/icingaweb2#25 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Front.php(954): Icinga\Web\Controller\Dispatcher->dispatch()
Icinga/icingaweb2#26 /usr/share/php/Icinga/Application/Web.php(294): Zend_Controller_Front->dispatch()
Icinga/icingaweb2#27 /usr/share/php/Icinga/Application/webrouter.php(105): Icinga\Application\Web->dispatch()
Icinga/icingaweb2#28 /usr/share/icingaweb2/public/index.php(4): require_once('...')
Icinga/icingaweb2#29 {main}
###########################

Expected behavior

no exception

Screenshots

If applicable, add screenshots to help explain your problem.

Your Environment

Include as many relevant details about the environment you experienced the problem in

  • Icinga Web 2 version and modules (System - About): 2.12.2
  • Web browser used: Edge Browser
  • Icinga 2 version used : r2.14.5-1
  • PHP version used (php --version): 8.1.2-1ubuntu2.20
  • Server operating system and version: Ubuntu 22.04.5 LTS

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions