-
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
Duplicate data in stdout and facts starting with RouterOS 7.2 #132
Comments
Reminds me a bit of #62. I unfortunately don't have ROS 7 (I'm still waiting for a ROS 7 device I ordered earlier this year, damn supply chain problems :D ). You might want to use the API modules instead if possible. |
Thanks for your reply. Yes, the supply chain problems suck. In the meantime you could also run a VM with the Cloud Hosted Router image, see: https://help.mikrotik.com/docs/pages/viewpage.action?pageId=18350234 or even some unofficial docker image that runs RouterOS inside a container: https://hub.docker.com/r/evilfreelancer/docker-routeros |
I noticed the same issue earlier and tried to locate where in the code the problem could be, but I haven't been successful so far. I also noticed that the behavior isn't persistent. It's radnom - mostly it is duplicated, but occasionally it is not. What's even worse is that the duplicated output is sometime merged into one line and if a more complex script is passed as the command with new line characters in it, the output of the command is randomly mixed together with the terminal prompt and the command itself and all is duplicated. The only thing I made sure so far is, that the command is not executed twice. It's duplicate output of the one command execution. |
I'm not sure anymore where exactly all the parsing magic happens, but I think it was here or in one of the callers: https://github.com/ansible-collections/ansible.netcommon/blob/main/plugins/connection/network_cli.py#L1176 Last time I've tried debugging something like that I used |
For me the duplication does not happen when |
Good time of day. Does RouterOS v7 work correctly with the api modules? |
I have not heard anything to the contrary. |
I have exactly the same issue (routeros 7.5 and 7.6). I can also reproduce that the duplicate output just happens with |
Hi there,
output:
|
You can run ROS 7 for free using Vagrant. The Vagrant box I'm using is
Vagrant.configure("2") do |config|
config.vm.define "routeros7" do |routeros|
routeros.vm.box = "cheretbe/routeros7"
routeros.vm.hostname = "routeros7.test"
routeros.vm.network :forwarded_port, guest: 22, host: 2827, id: "ssh"
end
end ok: [routeros7.hq.example.com] => {
"changed": false,
"invocation": {
"module_args": {
"commands": [
"/put [/system clock get time]"
],
"interval": 1,
"match": "all",
"retries": 10,
"wait_for": null
}
},
"stdout": [
"00:54:2600:54:26"
],
"stdout_lines": [
[
"00:54:2600:54:26"
]
]
} |
On RouterOS 7.6 I can reproduce this with the community.routeros.command module as well:
|
I am pretty confident that it is an upstream issue. It definitely relates to I have switched to using |
I've finally got my ROS7 device, I'll see whether I can debug this a bit next weekend or so... |
I think I managed to figure out what goes wrong; it seems to be a bug in the ansible.netcommon.network_cli connection plugin: ansible-collections/ansible.netcommon#517 When applying that change the duplicate output no longer happens for me. |
I took a look through everything, and while the fix does work, I don't think ansible-collections/ansible.netcommon#517 is quite the right answer. Can someone test ansible-collections/ansible.netcommon#521 and let me know if that works as well? |
@Qalthos I tested ansible-collections/ansible.netcommon#521, it also fixes the problem for me! |
Cool. Thanks for looking into it. I've closed 517 in favor of 521 and will merge 521 when I get a chance. |
@Qalthos cool, thanks a lot! Will it be possible to do a new 4.x.y bugfix release once that is merged? |
We won't be able to do that, unfortunately. |
I have exactly the same problem with duplicating data, only on RouterOS 7.8 Haven't fixed the bug yet? |
I dare to assume that because of this problem, the collection of facts on RouterOS 7.2-7.8 is broken, the example below.
The error I'm getting:
Is it necessary to open a new bug report for this? |
@izzzhoga while ansible-collections/ansible.netcommon#521 has been merged, no new release of ansible.netcommon has been made. Once a new release is out and you installed that one, the problem should be gone. If you want to have it fixed earlier, you need to patch your local ansible.netcommon install accordingly. The problem you have with facts gathering could also be caused by this. If the problem still happens with that fix applied, opening a new issue would help (then it's a problem in this collection). |
@felixfontein Please tell me when the new version of the module is planned to be released? :) |
@izzzhoga I do not know when the ansible.netcommon collection will have another release. |
ansible.netcommon 5.1.0 has been released (https://github.com/ansible-collections/ansible.netcommon/tree/5.1.0), it should contain that fix. (The changelog does mention it: https://github.com/ansible-collections/ansible.netcommon/blob/main/CHANGELOG.rst#v510) |
(If you are using Ansible (and not ansible-core with your own set of collections), you will have to wait for Ansible 8.0.0 though since it is a newer major version than the version included in 7.x.y.) |
SUMMARY
Starting with Router OS 7.2 stdout of
community.routeros.command
contains the output twice. And when runningcommunity.routeros.facts
against a device with RouterOS 7.2 or newer (tested up to RouterOS 7.6)hostvars[inventory_hostname]['ansible_net_config']
contains the config twice.ISSUE TYPE
COMPONENT NAME
community.routeros.facts
community.routeros.command
ANSIBLE VERSION
COLLECTION VERSION
OS / ENVIRONMENT
RouterOS>=7.2
STEPS TO REPRODUCE
EXPECTED RESULTS
stdout
andhostvars[inventory_hostname]['ansible_net_config']
should not contain duplicate data.ACTUAL RESULTS
stdout
andhostvars[inventory_hostname]['ansible_net_config']
contains duplicate data.The text was updated successfully, but these errors were encountered: