Merge pull request #7460 from northerngit/master

Use ip instead of deprecated ifconfig for Red Hat/CentOS guests
This commit is contained in:
Seth Vargo 2016-06-16 21:21:19 +02:00 committed by GitHub
commit 1be664477d
2 changed files with 2 additions and 2 deletions

View File

@ -35,7 +35,7 @@ module VagrantPlugins
interfaces = [] interfaces = []
commands = [] commands = []
comm.sudo("ifconfig -a | grep -o ^[0-9a-z]* | grep -v '^lo'") do |_, stdout| comm.sudo("ip -o -0 addr | grep -v LOOPBACK | awk '{print $2}' | sed 's/://'") do |_, stdout|
interfaces = stdout.split("\n") interfaces = stdout.split("\n")
end end

View File

@ -12,7 +12,7 @@ describe "VagrantPlugins::GuestRedHat::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("ip -o -0 addr | grep -v LOOPBACK | awk '{print $2}' | sed 's/://'",
stdout: "eth1\neth2") stdout: "eth1\neth2")
end end