Page MenuHomeVyOS Platform

connect/disconnect Missing newline in op-mode tab completion helper
Closed, ResolvedPublicBUG

Description

vyos@vyos:~$ disconnect interface
Possible completions:
  pppoe10wlm0   Take down a connection-oriented network interface

Details

Difficulty level
Unknown (require assessment)
Version
1.3-rolling-202006271315
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Cosmetic issue (typos etc.)

Event Timeline

c-po created this task.

@dmbaturin was there anything changed on the handling of op-mode? As I remember that this used to work.

The CLI uses:

<completionHelp>
  <path>interfaces pppoe</path>
  <path>interfaces wirelessmodem</path>
</completionHelp>

This only happens when there are multiple <path> options.

The allowed: command we generate now doesn't inject newlines between different paths:

# cat /opt/vyatta/share/vyatta-op/templates/connect/interface/node.tag/node.def 
help: Bring up a connection-oriented network interface

allowed: /bin/cli-shell-api listActiveNodes interfaces pppoe | sed -e "s/'//g" && /bin/cli-shell-api listActiveNodes interfaces wirelessmodem | sed -e "s/'//g"

run: sudo ${vyos_op_scripts_dir}/connect_disconnect.py --connect "$3"

Thus the output is indeed funny:

# /bin/cli-shell-api listActiveNodes interfaces pppoe | sed -e "s/'//g" && /bin/cli-shell-api listActiveNodes interfaces wirelessmodem | sed -e "s/'//g"
pppoe1 pppoe2wlm0[edit]

The idea was to avoid producing unnecessary newlines, but I took it to the point when it didn't produce necessary ones. ;)

I've added a hotfix with && echo between the outputs, which also produces unnecessary newlines. We may want to write a proper multi-path script I think.

c-po reassigned this task from c-po to dmbaturin.
erkin set Issue type to Cosmetic issue (typos etc.).Aug 29 2021, 1:50 PM
erkin removed a subscriber: Active contributors.