FreeBSD: Simplify the listing of interfaces
According to ifconfig(8), to list only Ethernet interfaces, excluding all other interface types, including the loopback interface, the command to use should be: ifconfig -l ether Related to: #8760
This commit is contained in:
parent
6edcf12979
commit
93f02c67f8
|
@ -18,8 +18,8 @@ module VagrantPlugins
|
||||||
# Remove any previous network additions to the configuration file.
|
# Remove any previous network additions to the configuration file.
|
||||||
commands << "sed -i '' -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/rc.conf"
|
commands << "sed -i '' -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/rc.conf"
|
||||||
|
|
||||||
comm.sudo("ifconfig -a | grep -o '^[0-9a-z]*' | grep -v '^lo'", options) do |_, stdout|
|
comm.sudo("ifconfig -l ether", options) do |_, stdout|
|
||||||
interfaces = stdout.split("\n")
|
interfaces = stdout.split
|
||||||
end
|
end
|
||||||
|
|
||||||
networks.each.with_index do |network, i|
|
networks.each.with_index do |network, i|
|
||||||
|
|
|
@ -13,8 +13,7 @@ describe "VagrantPlugins::GuestFreeBSD::Cap::ConfigureNetworks" do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow(machine).to receive(:communicate).and_return(comm)
|
allow(machine).to receive(:communicate).and_return(comm)
|
||||||
comm.stub_command("ifconfig -a | grep -o '^[0-9a-z]*' | grep -v '^lo'",
|
comm.stub_command("ifconfig -l ether", stdout: "em1 em2")
|
||||||
stdout: "em1\nem2")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
after do
|
after do
|
||||||
|
|
Loading…
Reference in New Issue