From 982534aaedf1ec22f0d1bb9e4d9f2960e1f00c49 Mon Sep 17 00:00:00 2001 From: Iku Iwasa Date: Wed, 2 Jan 2019 22:47:35 +0900 Subject: [PATCH] Fix grep command for network interface of CoreOS guest --- plugins/guests/coreos/cap/configure_networks.rb | 2 +- test/unit/plugins/guests/coreos/cap/configure_networks_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/guests/coreos/cap/configure_networks.rb b/plugins/guests/coreos/cap/configure_networks.rb index 827c8f075..fcff79da2 100644 --- a/plugins/guests/coreos/cap/configure_networks.rb +++ b/plugins/guests/coreos/cap/configure_networks.rb @@ -12,7 +12,7 @@ module VagrantPlugins machine.communicate.tap do |comm| # Read network interface names interfaces = [] - comm.sudo("ifconfig | grep '(e[n,t][h,s,p][[:digit:]]([a-z][[:digit:]])?' | cut -f1 -d:") do |_, result| + comm.sudo("ifconfig | grep -E '(e[n,t][h,s,p][[:digit:]]([a-z][[:digit:]])?)' | cut -f1 -d:") do |_, result| interfaces = result.split("\n") end diff --git a/test/unit/plugins/guests/coreos/cap/configure_networks_test.rb b/test/unit/plugins/guests/coreos/cap/configure_networks_test.rb index 28409ea6f..e8262d45c 100644 --- a/test/unit/plugins/guests/coreos/cap/configure_networks_test.rb +++ b/test/unit/plugins/guests/coreos/cap/configure_networks_test.rb @@ -21,7 +21,7 @@ describe "VagrantPlugins::GuestCoreOS::Cap::ConfigureNetworks" do allow(described_class).to receive(:get_ip).and_return("1.2.3.4") - comm.stub_command("ifconfig | grep '(e[n,t][h,s,p][[:digit:]]([a-z][[:digit:]])?' | cut -f1 -d:", + comm.stub_command("ifconfig | grep -E '(e[n,t][h,s,p][[:digit:]]([a-z][[:digit:]])?)' | cut -f1 -d:", stdout: "eth1\neth2") end