diff options
author | Daniil Baturin <daniil@vyos.io> | 2025-06-05 12:09:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-05 12:09:58 +0100 |
commit | 532fc2deae9bc53a98a238d6a594b4b23c6226f8 (patch) | |
tree | 166f3bf391c01035f298b4326c474b6ef60abd01 | |
parent | 7f3f67abc6159f7c0bcdf1086e14b140536a7df4 (diff) | |
parent | 7b23855303d6f72bc65e4272d024b9fbd229c611 (diff) | |
download | vyatta-cfg-532fc2deae9bc53a98a238d6a594b4b23c6226f8.tar.gz vyatta-cfg-532fc2deae9bc53a98a238d6a594b4b23c6226f8.zip |
Merge pull request #101 from jestabro/vyconf-cli
T7374: allow use of exisiting vyconf replacements for my_* commands
-rw-r--r-- | functions/interpreter/vyatta-cfg-run | 40 |
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" |