mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-31 21:13:00 +02:00
confd: add support for "replace" operation
When toggling settings like 'interfaces/interface/ipv6/enabled', which guards both link-local and all static addresses, the operation is not "create" or "delete", but "replace". Callback must take any "replace" on an 'enabled' node into account since none of the other nodes will be available in the diff. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
committed by
Tobias Waldekranz
parent
5be4a629f3
commit
d71a3b3db6
@@ -17,15 +17,19 @@ enum lydx_op lydx_get_op(struct lyd_node *node)
|
||||
if (opstr && !strcmp(opstr, "delete"))
|
||||
return LYDX_OP_DELETE;
|
||||
|
||||
if (opstr && !strcmp(opstr, "replace"))
|
||||
return LYDX_OP_REPLACE;
|
||||
|
||||
return LYDX_OP_NONE;
|
||||
}
|
||||
|
||||
void lydx_diff_print(struct lydx_diff *nd, FILE *fp)
|
||||
{
|
||||
static const char opchar[] = {
|
||||
[LYDX_OP_CREATE] = '+',
|
||||
[LYDX_OP_DELETE] = '-',
|
||||
[LYDX_OP_NONE] = '%',
|
||||
[LYDX_OP_CREATE] = '+',
|
||||
[LYDX_OP_DELETE] = '-',
|
||||
[LYDX_OP_REPLACE] = '|',
|
||||
[LYDX_OP_NONE] = '%',
|
||||
};
|
||||
|
||||
fprintf(fp, "%c%s %s%s ->%s%s\n",
|
||||
|
||||
@@ -15,6 +15,7 @@ enum lydx_op {
|
||||
LYDX_OP_NONE,
|
||||
LYDX_OP_CREATE,
|
||||
LYDX_OP_DELETE,
|
||||
LYDX_OP_REPLACE,
|
||||
};
|
||||
|
||||
struct lydx_diff {
|
||||
|
||||
Reference in New Issue
Block a user