Merge pull request #10763 from jlduran/freebsd-simplify-interfaces-list

FreeBSD: Simplify the listing of interfaces
This commit is contained in:
Brian Cain 2019-03-29 09:48:11 -07:00 committed by GitHub
commit 84e348bfab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -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|

View File

@ -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