Use ip instead of deprecated ifconfig for Red Hat/CentOS guests

This commit is contained in:
James Wilson 2016-06-16 10:06:58 +01:00
parent e65f61605d
commit 358ad8f18f
2 changed files with 2 additions and 2 deletions

View File

@ -35,7 +35,7 @@ module VagrantPlugins
interfaces = []
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")
end

View File

@ -12,7 +12,7 @@ describe "VagrantPlugins::GuestRedHat::Cap::ConfigureNetworks" do
before do
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")
end