-
Notifications
You must be signed in to change notification settings - Fork 47
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
Extra lines in stdout (ROS 6.49 to 7.1.5) #62
Comments
if i send the command with a space at the beginning it is ok commands:
- ' if ([/user find name=admin] !="") do={:put "exist"}' |
Maybe it's related to https://docs.ansible.com/ansible/devel/collections/community/routeros/docsite/ssh-guide.html#important-notes; have you tried adding something like |
I already tried it |
Maybe it's related to how prompts are detected in the SSH output. If that's the case, this will not be simple to fix. |
It is sad. Maybe you will try. Please |
Interestingly, I see similar results when running |
I have been playing around with this a bit. Neither downgrading ansible-core, nor downgrading ansible.netcommon, nor downgrading ansible-pylibssh, nor downgrading this collection did help. (I didn't combine any of these, maybe that would have been needed?) Maybe it's related to the RouterOS version? I have version 6.49.2 (latest release version) installed on my router. @heuels have you seen anything like this? |
I tried RouterOS 7.1 same output. |
Long-term 6.48.6 is ok In the changelog I see only one line about ssh |
Yeah, what's described there is exactly what's causing our problem. Hmm, changing |
I have |
What I observe in 6.49 but not in 6.48.6 or before, is that stdout contains a slash when it should be empty:
This breaks my validation as I have for each command:
I am not sure this is the same issue as described here, but it seems related to the same change in the OS... |
@sgrimee prepending your command with a space (I assume right now it starts with |
thanks @felixfontein, yes that does fix it, for lines starting not only with / but also : I have hundreds to change... so instead I patched the def run_commands(module, commands, check_rc=True):
...
command = " " + command
try:
out = connection.get(command, prompt, answer) This does the trick for me without having to change all the code. Cheers! |
@felixfontein would you accept a MR with this workaround (adding a space in front of every command) until a cleaner solution can be found? I have been running with it for a year now and it does not appear to cause any harm. But without it it breaks output validation from 6.49 on... |
@sgrimee I think it would be OK if this is only done for RouterOS versions where this problem actually happens (i.e. major version 6, starting at 6.49). Since the version is already retrieved it should be feasible to implement such a check - |
* Prompt support for ROS 6.49+ (#62) * More precise version match (#62) * Add changelog fragment and lint (#62) * Update changelogs/fragments/161-workaround-prompt-with-space.yml Co-authored-by: Felix Fontein <[email protected]> * Vendor version package to support older ansible versions (#62) * Update plugins/module_utils/routeros.py Co-authored-by: Felix Fontein <[email protected]> * Update plugins/module_utils/routeros.py Co-authored-by: Felix Fontein <[email protected]> * move PSF-2.0.txt to LICENSES folder --------- Co-authored-by: Felix Fontein <[email protected]>
I'm going to reopen this since #161 is more of a band-aid than a proper fix. |
SUMMARY
When I send a command to the router I get a response from the router with extra lines.
ISSUE TYPE
COMPONENT NAME
routeros
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
STEPS TO REPRODUCE
EXPECTED RESULTS
I want to get only output from line 3
ACTUAL RESULTS
I got 3 lines. First-line eq first letter of command, middle-lines = empty line(empty lines can be more than one), last line eq correct output.
The text was updated successfully, but these errors were encountered: