diff --git a/lib/vagrant/driver/virtualbox_4_0.rb b/lib/vagrant/driver/virtualbox_4_0.rb index 2f5b7b0b4ea..3a62bea8dae 100644 --- a/lib/vagrant/driver/virtualbox_4_0.rb +++ b/lib/vagrant/driver/virtualbox_4_0.rb @@ -219,7 +219,7 @@ def read_forwarded_ports(uuid=nil, active_only=false) end # Parse out the forwarded port information - if matcher = line =~ /^Forwarding.+?="(.+?),.+?,.*?,(.+?),.*?,(.+?)"$/ + if matcher = /^Forwarding.+?="(.+?),.+?,.*?,(.+?),.*?,(.+?)"$/.match(line) result = [current_nic, matcher[1], matcher[2].to_i, matcher[3].to_i] @logger.debug(" - #{result.inspect}") results << result @@ -331,19 +331,19 @@ def read_network_interfaces nics = {} info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) info.split("\n").each do |line| - if matcher = line =~ /^nic(\d+)="(.+?)"$/ + if matcher = /^nic(\d+)="(.+?)"$/.match(line) adapter = matcher[1].to_i type = matcher[2].to_sym nics[adapter] ||= {} nics[adapter][:type] = type - elsif matcher = line =~ /^hostonlyadapter(\d+)="(.+?)"$/ + elsif matcher = /^hostonlyadapter(\d+)="(.+?)"$/.match(line) adapter = matcher[1].to_i network = matcher[2].to_s nics[adapter] ||= {} nics[adapter][:hostonly] = network - elsif matcher = line =~ /^bridgeadapter(\d+)="(.+?)"$/ + elsif matcher = /^bridgeadapter(\d+)="(.+?)"$/.match(line) adapter = matcher[1].to_i network = matcher[2].to_s diff --git a/lib/vagrant/driver/virtualbox_4_1.rb b/lib/vagrant/driver/virtualbox_4_1.rb index 7424f549469..eb43419cef6 100644 --- a/lib/vagrant/driver/virtualbox_4_1.rb +++ b/lib/vagrant/driver/virtualbox_4_1.rb @@ -219,7 +219,7 @@ def read_forwarded_ports(uuid=nil, active_only=false) end # Parse out the forwarded port information - if matcher = line =~ /^Forwarding.+?="(.+?),.+?,.*?,(.+?),.*?,(.+?)"$/ + if matcher = /^Forwarding.+?="(.+?),.+?,.*?,(.+?),.*?,(.+?)"$/.match(line) result = [current_nic, matcher[1], matcher[2].to_i, matcher[3].to_i] @logger.debug(" - #{result.inspect}") results << result @@ -331,19 +331,19 @@ def read_network_interfaces nics = {} info = execute("showvminfo", @uuid, "--machinereadable", :retryable => true) info.split("\n").each do |line| - if matcher = line =~ /^nic(\d+)="(.+?)"$/ + if matcher = /^nic(\d+)="(.+?)"$/.match(line) adapter = matcher[1].to_i type = matcher[2].to_sym nics[adapter] ||= {} nics[adapter][:type] = type - elsif matcher = line =~ /^hostonlyadapter(\d+)="(.+?)"$/ + elsif matcher = /^hostonlyadapter(\d+)="(.+?)"$/.match(line) adapter = matcher[1].to_i network = matcher[2].to_s nics[adapter] ||= {} nics[adapter][:hostonly] = network - elsif matcher = line =~ /^bridgeadapter(\d+)="(.+?)"$/ + elsif matcher = /^bridgeadapter(\d+)="(.+?)"$/.match(line) adapter = matcher[1].to_i network = matcher[2].to_s