diff --git a/CHANGELOG.md b/CHANGELOG.md index 03d81c7..65451aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ Expected: February 2024 ### Corrected Bugs +* Fixed: ["commit diff" after applying a service always seems to show a diff](https://github.com/clicon/clixon-controller/issues/70) * Fixed: [Backend may exit with assertion if the device return warnings](https://github.com/clicon/clixon-controller/issues/77) * Fixed: [apply template with multiple variables do not work in some cases](https://github.com/clicon/clixon-controller/issues/74) diff --git a/src/controller_configure.cli b/src/controller_configure.cli index 05104bd..5d702a0 100644 --- a/src/controller_configure.cli +++ b/src/controller_configure.cli @@ -18,9 +18,9 @@ delete("Delete a configuration item") { all("Delete whole candidate configuration"), delete_all("candidate"); } quit("Quit"), cli_quit(); -commit("Commit the changes, trigger services scripts"), cli_rpc_controller_commit("candidate", "CHANGE", "COMMIT");{ +commit("Run services, commit and push to devices"), cli_rpc_controller_commit("candidate", "CHANGE", "COMMIT");{ diff("Show the result of running the services but do not commit"), cli_rpc_controller_commit("candidate", "CHANGE", "NONE"); - push("Run services and push to devices"), cli_rpc_controller_commit("candidate", "CHANGE", "COMMIT"); + push("Run services, commit and push to devices"), cli_rpc_controller_commit("candidate", "CHANGE", "COMMIT"); local("Local commit, do not push to devices"), cli_commit(); } validate("Validate changes"), cli_validate();{ diff --git a/src/controller_rpc.c b/src/controller_rpc.c index 73f20aa..f69a8d4 100644 --- a/src/controller_rpc.c +++ b/src/controller_rpc.c @@ -915,9 +915,6 @@ controller_commit_actions(clixon_handle h, /* 1) copy candidate to actions and remove all device config tagged with services */ if (xmldb_copy(h, "candidate", "actions") < 0) goto done; - /* Strip service data in device config for services that changed */ - if (strip_service_data_from_device_config(h, "actions", cvv) < 0) - goto done; if (services){ if (actions == AT_FORCE || cvec_len(cvv) > 0){ /* There are service changes */ if ((notifycb = cbuf_new()) == NULL){ @@ -934,7 +931,9 @@ controller_commit_actions(clixon_handle h, cprintf(notifycb, ""); } cprintf(notifycb, ""); - + /* Strip service data in device config for services that changed */ + if (strip_service_data_from_device_config(h, "actions", cvv) < 0) + goto done; clicon_debug(1, "%s stream_notify: services-commit: %" PRIu64, __FUNCTION__, ct->ct_id); if (stream_notify(h, "services-commit", "%s", cbuf_get(notifycb)) < 0) goto done; diff --git a/test/test-c-service.sh b/test/test-c-service.sh index f72f6d9..9137b43 100755 --- a/test/test-c-service.sh +++ b/test/test-c-service.sh @@ -347,6 +347,10 @@ new "commit push" set +e expectpart "$(${clixon_cli} -m configure -1f $CFG commit push 2>&1)" 0 OK --not-- Error +# see https://github.com/clicon/clixon-controller/issues/70 +new "commit diff" +expectpart "$(${clixon_cli} -m configure -1f $CFG commit diff 2>&1)" 0 OK --not-- "/devices/device\[name=\"openconfig1\"\]/config/interfaces/interface\[name=\"A0y\"\]/devices/device\[name=\"openconfig1\"\]/config/interfaces/interface\[name=\"ABx\"\]/devices/device\[name=\"openconfig1\"\]/config/interfaces/interface\[name=\"ABy\"\]/devices/device\[name=\"openconfig1\"\]/config/interfaces/interface\[name=\"Ax\"\]/devices/device\[name=\"openconfig1\"\]/config/interfaces/interface\[name=\"Ay\"\]/devices/device\[name=\"openconfig2\"\]/config/interfaces/interface\[name=\"A0x\"\]/devices/device\[name=\"openconfig2\"\]/config/interfaces/interface\[name=\"A0y\"\]/devices/device\[name=\"openconfig2\"\]/config/interfaces/interface\[name=\"ABx\"\]/devices/device\[name=\"openconfig2\"\]/config/interfaces/interface\[name=\"ABy\"\]/devices/device\[name=\"openconfig2\"\]/config/interfaces/interface\[name=\"Ax\"\]/devices/device\[name=\"openconfig2\"\]/config/interfaces/interface\[name=\"Ay\"\]" CREATORSB="testB\[name='foo'\]/devices/device\[name=\"openconfig1\"\]/config/interfaces/interface\[name=\"A0x\"\]/devices/device\[name=\"openconfig1\"\]/config/interfaces/interface\[name=\"A0y\"\]/devices/device\[name=\"openconfig1\"\]/config/interfaces/interface\[name=\"ABx\"\]/devices/device\[name=\"openconfig1\"\]/config/interfaces/interface\[name=\"ABy\"\]/devices/device\[name=\"openconfig1\"\]/config/interfaces/interface\[name=\"ABz\"\]/devices/device\[name=\"openconfig1\"\]/config/interfaces/interface\[name=\"Bx\"\]/devices/device\[name=\"openconfig2\"\]/config/interfaces/interface\[name=\"A0x\"\]/devices/device\[name=\"openconfig2\"\]/config/interfaces/interface\[name=\"A0y\"\]/devices/device\[name=\"openconfig2\"\]/config/interfaces/interface\[name=\"ABx\"\]/devices/device\[name=\"openconfig2\"\]/config/interfaces/interface\[name=\"ABy\"\]/devices/device\[name=\"openconfig2\"\]/config/interfaces/interface\[name=\"ABz\"\]/devices/device\[name=\"openconfig2\"\]/config/interfaces/interface\[name=\"Bx\"\]" diff --git a/test/test-cli-edit-config.sh b/test/test-cli-edit-config.sh index ac5a61e..25e1241 100755 --- a/test/test-cli-edit-config.sh +++ b/test/test-cli-edit-config.sh @@ -161,6 +161,6 @@ new "Sleep and verify devices are open 3" sleep_open new "Testrun after restart" -testrun +testrun # XXX This fails on regression occasionally endtest