Icinga director sync rule for recreation service template

I want to update existing service template.
I try to sync service template but I get error that I can not to recreate service

This Sync Rule failed when last checked at 2020-06-23 14:52:51: Exception while syncing Icinga\Module\Director\Objects\IcingaService check_gc: Trying to recreate icinga_service ("{“object_name”:“check_gc”}")

My import source

Sync rule

Why I can not to recreate/update existing service template?

I have exactly the same problem, creation of new service templates works correctly, but unfortunately update fails, for the test i’ve tried to reconfigure sync rule to sync Hosts instead of Service template and it works perfect.

https://icinga.com/docs/director/latest/doc/70-Import-and-Sync/ have a statement:

The only tricky part here are the chosen Properties. You must know them and you are required to fill them in, no way around this right now. Also please choose one column as your key column.

And it’s not clear on what needs to be done.

@theFeu could we please get some clarification on this? i’m not sure if its a bug or we need missed to configure something in import/sync rules.

With best regards,

Sorry for the late response, I was on holiday :slight_smile:
I don’t actually know myself, I’ll ask around!

Okay, so:

Apparently one of my colleagues did use the the sync rules in a similar fashion, but with he wrote some patches for the director himself first, which broke some other stuff.
And It also didn’t work all that well either, as the synch functionality was not meant for this use case.
The sync is made for objects, but not for templates. It does work, in a way, but it feels similar to eating soup with a fork to me :sweat_smile:
So, I would not recommended.

Instead, you should maybe look into using baskets for that. They for example automagically deal with linked custom field definitions and are made for your purpose.