In a specific use-case, I need to execute a command containing a Questionmark "?" using the eos_command module through network_cli. This fails, as typing the "?" on Cli will lead to an immediate response from the device showing valid commands that can followup what has already been typed.
When manually working on the CLI, you can "escape" the "?" by typing CTRL+V followed by the "?". I haven't found any option to achieve something similar using the eos_command module.
Is there a character that can be used to escape the "?" or is there some cli-context that will not interpret the "?" dynamically (as soon as it is typed)?
You can replicate the issue with the following command (just an example):
sh int status | grep -P '^((?!Not).)*$'
The command should list all Ports (sh int status) which don't contain the string "Not" (aiming at the "Not present" when no transceiver is inserted)
You can run the command manually, if you escape the "?" using Ctrl-V
Pasting the command to CLI will lead to an immediate linebreak (due to suggestions showing for the "?") followed by the command sitting on the cli without the "?" so just: sh int status | grep -P '^((!Not).)*$'
The same also happens when running the command via the eos_command module like so:
- name: test
eos_command:
commands:
- sh int status | grep -P '^((?!Not).)*$'
Let me know if further info is needed
ISSUE TYPE
I think the behaviour is somehow expected (due to how CLI behaves when you input a "?"). But this behaviour kinda limits the use, so it would be great to have some sort of workaround
COMPONENT NAME
arista.eos.eos_command module
ANSIBLE VERSION
ansible [core 2.12.10]
COLLECTION VERSION
arista.eos 6.1.2
STEPS TO REPRODUCE
You can replicate the issue with the following command (just an example):
sh int status | grep -P '^((?!Not).)*$'
The command should list all Ports (sh int status) which don't contain the string "Not" (aiming at the "Not present" when no transceiver is inserted)
You can issue the command fine manually, if you escape the "?" using Ctrl-V
Pasting the command to CLI will lead to an immediate linebreak (due to suggestions showing for the "?") followed by the command sitting on the cli without the "?" so just: sh int status | grep -P '^((!Not).)*$'
The same also happens when running the command via the eos_command module like so:
- name: test
eos_command:
commands:
- sh int status | grep -P '^((?!Not).)*$'
SUMMARY
In a specific use-case, I need to execute a command containing a Questionmark "?" using the eos_command module through network_cli. This fails, as typing the "?" on Cli will lead to an immediate response from the device showing valid commands that can followup what has already been typed.
When manually working on the CLI, you can "escape" the "?" by typing CTRL+V followed by the "?". I haven't found any option to achieve something similar using the eos_command module.
Is there a character that can be used to escape the "?" or is there some cli-context that will not interpret the "?" dynamically (as soon as it is typed)?
You can replicate the issue with the following command (just an example):
The command should list all Ports (sh int status) which don't contain the string "Not" (aiming at the "Not present" when no transceiver is inserted)
Let me know if further info is needed
ISSUE TYPE
I think the behaviour is somehow expected (due to how CLI behaves when you input a "?"). But this behaviour kinda limits the use, so it would be great to have some sort of workaround
COMPONENT NAME
arista.eos.eos_command module
ANSIBLE VERSION
COLLECTION VERSION
STEPS TO REPRODUCE
You can replicate the issue with the following command (just an example):
The command should list all Ports (sh int status) which don't contain the string "Not" (aiming at the "Not present" when no transceiver is inserted)