From 358ad8f18ff4f6780ea6345043996226568d0bb9 Mon Sep 17 00:00:00 2001 From: James Wilson Date: Thu, 16 Jun 2016 10:06:58 +0100 Subject: [PATCH] Use ip instead of deprecated ifconfig for Red Hat/CentOS guests --- plugins/guests/redhat/cap/configure_networks.rb | 2 +- test/unit/plugins/guests/redhat/cap/configure_networks_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/guests/redhat/cap/configure_networks.rb b/plugins/guests/redhat/cap/configure_networks.rb index e7e81031a..c8052d79c 100644 --- a/plugins/guests/redhat/cap/configure_networks.rb +++ b/plugins/guests/redhat/cap/configure_networks.rb @@ -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 diff --git a/test/unit/plugins/guests/redhat/cap/configure_networks_test.rb b/test/unit/plugins/guests/redhat/cap/configure_networks_test.rb index d89f8928a..e63259a87 100644 --- a/test/unit/plugins/guests/redhat/cap/configure_networks_test.rb +++ b/test/unit/plugins/guests/redhat/cap/configure_networks_test.rb @@ -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