Experimental: Added CLICON_TRANSACTION_MOD configurqation option. If set,
modifications in validation and commit callbacks are written back into the datastore.
This commit is contained in:
parent
695aef2cb6
commit
11e2b91a05
3 changed files with 21 additions and 1 deletions
|
|
@ -239,13 +239,20 @@ candidate_commit(clicon_handle h,
|
|||
if (plugin_transaction_commit(h, td) < 0)
|
||||
goto done;
|
||||
|
||||
/* 8. Success: Copy candidate to running */
|
||||
/* Optionally write (potentially modified) tree back to candidate */
|
||||
if (clicon_option_bool(h, "CLICON_TRANSACTION_MOD"))
|
||||
if (xmldb_put(h, candidate, OP_REPLACE, td->td_target) < 0)
|
||||
goto done;
|
||||
/* 8. Success: Copy candidate to running
|
||||
*/
|
||||
|
||||
if (xmldb_copy(h, candidate, "running") < 0)
|
||||
goto done;
|
||||
|
||||
/* 9. Call plugin transaction end callbacks */
|
||||
plugin_transaction_end(h, td);
|
||||
|
||||
|
||||
/* 8. Copy running back to candidate in case end functions updated running */
|
||||
if (xmldb_copy(h, "running", candidate) < 0){
|
||||
/* ignore errors or signal major setback ? */
|
||||
|
|
@ -392,6 +399,10 @@ from_client_validate(clicon_handle h,
|
|||
clicon_err_reason);
|
||||
goto ok;
|
||||
}
|
||||
/* Optionally write (potentially modified) tree back to candidate */
|
||||
if (clicon_option_bool(h, "CLICON_TRANSACTION_MOD"))
|
||||
if (xmldb_put(h, "candidate", OP_REPLACE, td->td_target) < 0)
|
||||
goto done;
|
||||
cprintf(cbret, "<rpc-reply><ok/></rpc-reply>");
|
||||
ok:
|
||||
retval = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue