Resync after changing sync properties

Hi,

I’m searching for a way to rerun a sync rule after changing sync properties, but when there was no change on imported source data.

Director caches/hashes import source data and only allows to trigger a sync when there are new or changed source items, but seems to ignore changes in sync properties, ie. new or renamed custom vars.

Greetings
Manfred

Hi,

I haven’t seen such a “forced” sync yet, might qualify for a feature request on GitHub. Maybe you can use a dummy object where you change e.g. the host notes and force a resync that way.

Cheers,
Michael

A sync will always have changes when the resulting object changes.

It is not directly related to the import, it will only use its latest data. Change logic is not related to the Import source changing, but the resulting objects properties

1 Like

Changing sync properties and check for changes/triggering a new sync, director says “Nothing changed, rule still in sync” - and no sync happens.

It seems that director does not recognise the changed sync properties.

Are you sure the actual result changed?

Director will “update” the target object with your sync properties. When the resulting object is not actually changed, it is not a modification, and therefor “in sync”.

Let’s say we have this import data - YAML for now.

- name: 'host1'
  ip: '1.1.1.1'
  wiki_url: null
- name: 'host2'
  ip: '1.1.1.2'
  wiki_url: null

You sync these properties:

  • ${name} -> object_name
  • ${up} -> address

And afterwards you add a new property:

  • ${wiki_url} -> notes_url

Now the Wiki URL is not really updated in the resulting object, so no change for Director. Same will happen when the Wiki URL has been set manually and the import now has the correct property.

Could you show us some examples? Data, Sync, Objects?

Here is an example:

Import source is a mySQL CMDB, where several host properties are stored (name, ip,…),
query is SELECT * FROM cmdb.hosts;

Sync rule uses the source above, type host.
Sync properties look like this:

But when changing sync properties (change sort order, add additional value), nothing happens
when triggering a new sync. I’ve also tried to add a new column to import source, but director only
reports changes within import source, but not within sync rule???

Environment:
Icinga2 r2.10.4-1
Icingaweb2 2.6.2
Director (master?, files from Nov. 2018)
OS: openSUSE Leap 15.0, apache 2.4, php 7.2

If you add a new var that already was in your last import, it should set it in sync accordingly.

I don’t know why this shouldn’t work for you, it worked in every setup I touched.

1 Like

If the variable is really new to the sync properties, it works as you said.

But if I only change the order or set a new value for an existing variable, it seems that it does not recognize the change.

Order is only relevant when you change properties where this is relevant.

  • import will change the order inside the import list
  • for all other vars when the order changes the resulting value

What matters for Director is only the result in the object.

1 Like

Thanks for your support, found the problem - there was a typo in sync properties filter expression.

1 Like