Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

op-mode: T4038: Remove legacy vyatta-image-tools.pl #84

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

erkin
Copy link
Contributor

@erkin erkin commented Nov 20, 2023

In addition, this fixes some bugs I found in vyatta-op completion system that were causing problems with the new implementation.
See vyos/vyos-1x#2507.

Copy link
Contributor

@jestabro jestabro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that one needs to remove reference to vyatta-image-tools.pl in Makefile.am

@jestabro
Copy link
Contributor

jestabro commented Dec 16, 2023

Details in comment:
vyos/vyos-1x#2507 (comment)

Exclude file.py from paging:

diff --git a/functions/interpreter/vyatta-op-run b/functions/interpreter/vyatta-op-run
index ee4cb1c..3260781 100644
--- a/functions/interpreter/vyatta-op-run
+++ b/functions/interpreter/vyatta-op-run
@@ -218,7 +218,7 @@ _vyatta_op_run ()
     local run_cmd=$(_vyatta_op_get_node_def_field $tpath/node.def run)
     run_cmd=$(_vyatta_op_conv_run_cmd "$run_cmd") # convert the positional parameters
     local ret=0
-    local cmd_regex="^(LESSOPEN=|less|pager|tail|/opt/vyatta/bin/vyatta-tshark-interface-port.pl).*"
+    local cmd_regex="^(.*/file.py.*|LESSOPEN=|less|pager|tail|/opt/vyatta/bin/vyatta-tshark-interface-port.pl).*"
     if [ -n "$run_cmd" ]; then
       eval $restore_shopts
       if [[ -t 1 &&  "${args[1]}" == "show" && ! $run_cmd =~ $cmd_regex ]] ; then

@jestabro
Copy link
Contributor

jestabro commented Jan 9, 2024

The fix above does not quite work, as the run_cmd is, for comparison with the regex:
sudo ${vyos_op_scripts_dir}/file.py
without interpretation. I have yet to improve on the overkill in the patch above, but either that or a smarter pattern is needed.

@jestabro
Copy link
Contributor

jestabro commented Jan 9, 2024

The following should work:

diff --git a/functions/interpreter/vyatta-op-run b/functions/interpreter/vyatta-op-run
index 7d67231..6bf6645 100644
--- a/functions/interpreter/vyatta-op-run
+++ b/functions/interpreter/vyatta-op-run
@@ -219,7 +219,8 @@ _vyatta_op_run ()
     run_cmd=$(_vyatta_op_conv_run_cmd "$run_cmd") # convert the positional parameters
     local ret=0
     # Exception for the `show file` command
-    local cmd_regex="^(LESSOPEN=|less|pager|tail|(sudo )?/usr/libexec/vyos/op_mode/file.py).*"
+    local file_cmd='\$\{vyos_op_scripts_dir\}\/file\.py'
+    local cmd_regex="^(LESSOPEN=|less|pager|tail|(sudo )?$file_cmd).*"
     if [ -n "$run_cmd" ]; then
       eval $restore_shopts
       if [[ -t 1 &&  "${args[1]}" == "show" && ! $run_cmd =~ $cmd_regex ]] ; then

@dmbaturin dmbaturin merged commit 0949fdb into vyos:current Feb 8, 2024
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants