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

Vagrant 1.8.6 introduced bug in plugins/guests/linux/cap/network_interfaces.rb (comparison of Array with Array failed) #7883

Closed
TomaszUrugOlszewski opened this issue Oct 10, 2016 · 2 comments

Comments

@TomaszUrugOlszewski
Copy link

TomaszUrugOlszewski commented Oct 10, 2016

Hello,

For some outputs generated by:
/sbin/ip -o -0 addr | grep -v LOOPBACK | awk '{print $2}' | sed 's/://'

Script produces an error:

/opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/guests/linux/cap/network_interfaces.rb:29:in `sort': comparison of Array with Array failed (ArgumentError)
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/guests/linux/cap/network_interfaces.rb:29:in `network_interfaces'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/capability_host.rb:111:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/lib/vagrant/capability_host.rb:111:in `capability'

Here are example data sets, one which works (currently uncommented) and second one, which doesn't:

#ifaces = ["eth0", "eth1", "docker0", "veth437f7f9", "veth06b3e44", "veth8bb7081"]
ifaces = [ "eth0", "eth1", "docker0", "veth2cea1c9", "vethf058250", "veth1a8ff66" ]


ifaces = ifaces.map do |iface|
  iface.scan(/(.+?)(\d+)/).flatten.map do |iface_part|
    if iface_part.to_i.to_s == iface_part
      iface_part.to_i
    else
      iface_part
    end
  end
end.sort.map(&:join)
@chrisroberts
Copy link
Member

@TomaszUrugOlszewski Thanks for providing the failing example. Tests have been updated and implementation reworked to properly handle it within #7866. Cheers!

@ghost
Copy link

ghost commented Apr 3, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants