Icinga / icingaweb2-module-director

The Director aims to be your new favourite Icinga config deployment tool. Director is designed for those who want to automate their configuration deployment and those who want to grant their “point & click” users easy access to the configuration.
https://icinga.com/docs/director/latest
GNU General Public License v2.0
413 stars 203 forks source link

"Update Policy" in sync rule doesnt work as expected with REST API import source #2883

Closed MAngel666 closed 3 months ago

MAngel666 commented 6 months ago

Expected Behavior

If a key already exists in imported data, depending on the chosen "Update Policy" in sync rule, the key should be merged, replaced, ignored or updated.

Current Behavior

Update policies merge, replace or ignore always result in this error message, if a key already exist:

`Oops, an error occurred!

Exception while syncing Icinga\Module\Director\Objects\IcingaHostGroup Atlassian - JIRA-Confluence-Service Desk: Trying to recreate icinga_hostgroup ("Atlassian - JIRA-Confluence-Service Desk") (Sync.php:946)

0 /usr/share/icingaweb2/modules/director/application/forms/SyncRunForm.php(56): Icinga\Module\Director\Import\Sync->apply()

https://github.com/Icinga/icingaweb2-module-director/issues/1 /usr/share/icinga-php/ipl/vendor/ipl/html/src/Form.php(238): Icinga\Module\Director\Forms\SyncRunForm->onSuccess()

https://github.com/Icinga/icingaweb2-module-director/pull/2 /usr/share/icingaweb2/modules/director/application/controllers/SyncruleController.php(69): ipl\Html\Form->handleRequest(Object(GuzzleHttp\Psr7\ServerRequest))

https://github.com/Icinga/icingaweb2-module-director/pull/3 /usr/share/icinga-php/vendor/vendor/shardj/zf1-future/library/Zend/Controller/Action.php(516): Icinga\Module\Director\Controllers\SyncruleController->indexAction()

https://github.com/Icinga/icingaweb2-module-director/pull/4 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch('indexAction')

https://github.com/Icinga/icingaweb2-module-director/pull/5 /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))

https://github.com/Icinga/icingaweb2-module-director/pull/6 /usr/share/php/Icinga/Application/Web.php(294): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))

https://github.com/Icinga/icingaweb2-module-director/pull/7 /usr/share/php/Icinga/Application/webrouter.php(105): Icinga\Application\Web->dispatch()

https://github.com/Icinga/icingaweb2-module-director/pull/8 /usr/share/icingaweb2/public/index.php(4): require_once('/usr/share/php/...')

https://github.com/Icinga/icingaweb2-module-director/pull/9 {main}``

Update Policy - update does nothing with message: "Nothing would change, the rule is still in sync".

Interestingly, this only happens only with REST API import sources. With a Fileshipper source, everything works as it should.

Possible Solution

no solution yet

Steps to Reproduce (for bugs)

configure a REST API import source import data configure sync rule for the REST API import source try to import an already existing key

Your Environment

MAngel666 commented 3 months ago

I didn't consider the function of the "Key Column Name" during the import. If you use it correctly, there won't be any problems.