When two or more groups try to modify the same field in an incompatible way then a conflict is generated that will prevent the systemd unif file to be generated. Modifying a field in an incompatible way means any sequence of modifications such that the final result will depend on the order in which these operations are performed.
These are some common situations that issue a conflict:
set a field and another group perform any modification to the same field;
add a field and another group reset the same field.
Notice that add operations on the same field do not generate conflicts because ordering is not preserved by add operations, in this way Tomloader can rearrange the values in order to make the final result independent on the order of the add operations.
The following table shows all the possible outcomes when two nodes try to modify the came field. The ‘C’ outcome means a conflict, the ‘V’ outcome means no conflict will be generated, with an explaination on how they interact.
section | set | reset | add | |
|---|---|---|---|---|
section | V, childs are merged | |||
set | C | C | ||
reset | C | C | V | |
add | C | C | C | V, all the values are added |
To resolve a conflict, you should specify inside the sd node of the respective unit configuration file the final value for the conflicting fields. Only set and reset operations can be used to resolve a conflict.
// groups.kdl def-group GroupA { sd { (section) Service { (set) Type simple } } } def-group GroupB { sd { (section) Service { (set) Type exec } } } // unit.service.kdl pull { GroupA GroupB // A conflict is issued because both GroupA and GroupB try to set // the Type field. // // This conflict is solved in the next sd node. } sd { (section) Service { (set) Type oneshot } }