summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2025-05-26 21:41:17 -0500
committerJohn Estabrook <jestabro@vyos.io>2025-05-26 21:41:17 -0500
commit7b23855303d6f72bc65e4272d024b9fbd229c611 (patch)
tree09fa7558d3586d062f90e61c98fdd89d9a165b8d
parent7ad72b356123214946c6f8c0f3c801fcd8b0c562 (diff)
downloadvyatta-cfg-7b23855303d6f72bc65e4272d024b9fbd229c611.tar.gz
vyatta-cfg-7b23855303d6f72bc65e4272d024b9fbd229c611.zip
T7374: allow use of exisiting vyconf replacements for my_* commands
-rw-r--r--functions/interpreter/vyatta-cfg-run40
1 files changed, 32 insertions, 8 deletions
diff --git a/functions/interpreter/vyatta-cfg-run b/functions/interpreter/vyatta-cfg-run
index 26013d7..e34e430 100644
--- a/functions/interpreter/vyatta-cfg-run
+++ b/functions/interpreter/vyatta-cfg-run
@@ -103,9 +103,17 @@ vyatta_config_show ()
vyatta_config_commit ()
{
- if ! vyatta_cli_shell_api sessionChanged; then
- echo "No configuration changes to commit"
- return 1;
+ if test -f "/var/run/vyconf_backend"; then
+ echo $$
+ if ! /usr/libexec/vyos/vyconf/bin/vy_session_changed; then
+ echo "No configuration changes to commit"
+ return 1;
+ fi
+ else
+ if ! vyatta_cli_shell_api sessionChanged; then
+ echo "No configuration changes to commit"
+ return 1;
+ fi
fi
local comment="commit"
local next=0
@@ -126,16 +134,28 @@ vyatta_config_commit ()
export COMMIT_COMMENT="$comment"
export COMMIT_VIA=cli
- /opt/vyatta/sbin/my_commit "${args[@]}" 2>&1
+ if test -f "/var/run/vyconf_backend"; then
+ /usr/libexec/vyos/vyconf/bin/vy_commit "${args[@]}" 2>&1
+ else
+ /opt/vyatta/sbin/my_commit "${args[@]}" 2>&1
+ fi
unset COMMIT_VIA
unset COMMIT_COMMENT
}
vyatta_config_commit-confirm ()
{
- if ! vyatta_cli_shell_api sessionChanged; then
- echo "No configuration changes to commit"
- return 1;
+ if test -f "/var/run/vyconf_backend"; then
+ echo $$
+ if ! /usr/libexec/vyos/vyconf/bin/vy_session_changed; then
+ echo "No configuration changes to commit"
+ return 1;
+ fi
+ else
+ if ! vyatta_cli_shell_api sessionChanged; then
+ echo "No configuration changes to commit"
+ return 1;
+ fi
fi
local -a args=()
local first=1
@@ -358,7 +378,11 @@ vyatta_cfg_cmd_run ()
elif [[ "$cmd" == "show" ]]; then
vyatta_config_show "${@:2}"
else
- cmd="/opt/vyatta/sbin/my_$cmd"
+ if test -f "/var/run/vyconf_backend"; then
+ cmd="${vyconf_bin_dir}/vy_$cmd"
+ else
+ cmd="/opt/vyatta/sbin/my_$cmd"
+ fi
output=$($cmd "${@:2}")
fi
vyatta_cfg_print_output "$output"