handlers.relation_sync_handler
Synchronizes relations from one fact sheet type to another fact sheet type.
Relation triangle:
- There are 3 fact sheet types: 0, 1 and 2.
- rel_0_to_1 and rel_1_to_2 are leading.
- rel_0_to_2 is derived from the two leading relations.
Example: A Server with the ITComponents "Windows Server 2019" and "IBM DB2" is linked to an Application. Then this automation links the ITComponents "Windows Server 2019" and "IBM DB2" to the Application as well. If the Server is removed from the Application or upgraded to another operating system, the ITComponents of the Application are kept consistent automatically (outdated ones removed, new ones added).
You can set the config value "delete_outdated" to False
(default: True
) if you don't want to
automatically clean up outdated relations. Works if you touch rel_0_to_1 or rel_1_to_2.
WARNING: If this is set to True
, it really removes all relations between fs0 and fs2 that don't have a linking
fs1 between them! In the "Server" example, it really removes all ITComponents from an Application that are not
linked to any of the Application's Servers, also the manually-linked ones. If you don't want that, set
keep_manual_relations
to True
.
You can set the config value "watch_auto_relations" to True (default: False) if you want to monitor freshly created/modified/deleted rel_0_to_2 relations and see if the edit was ok, or if it needs to be reverted.
Recommendation: Set both config values to true or both to false.
Whenever you set up a new relation_sync automation, make sure to follow this procedure:
- Deactivate the Webhook
- Create the feature config
- Temporarily set all other feature configs of the relation_sync handler to “inactive”
- Trigger the initial full sync using ssh and this command:
DJANGO_SETTINGS_MODULE=leanixdqm.production python -m scripts.lx.relation_sync - Re-activate the webhook and the other feature configs