guests/linux: Update constant name, freeze constant values
This commit is contained in:
parent
9f468d2626
commit
0300df09fb
|
@ -5,7 +5,7 @@ module VagrantPlugins
|
||||||
# Valid ethernet device prefix values.
|
# Valid ethernet device prefix values.
|
||||||
# eth - classic prefix
|
# eth - classic prefix
|
||||||
# en - predictable interface names prefix
|
# en - predictable interface names prefix
|
||||||
ETHERNET_PREFIX = ["eth", "en"]
|
POSSIBLE_ETHERNET_PREFIXES = ["eth".freeze, "en".freeze].freeze
|
||||||
|
|
||||||
@@logger = Log4r::Logger.new("vagrant::guest::linux::network_interfaces")
|
@@logger = Log4r::Logger.new("vagrant::guest::linux::network_interfaces")
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ module VagrantPlugins
|
||||||
# Break out integers from strings and sort the arrays to provide
|
# Break out integers from strings and sort the arrays to provide
|
||||||
# a natural sort for the interface names
|
# a natural sort for the interface names
|
||||||
ifaces = ifaces.map do |iface|
|
ifaces = ifaces.map do |iface|
|
||||||
unless eth_prefix
|
if eth_prefix.nil?
|
||||||
eth_prefix = ETHERNET_PREFIX.detect do |prefix|
|
eth_prefix = POSSIBLE_ETHERNET_PREFIXES.detect do |prefix|
|
||||||
iface.start_with?(prefix)
|
iface.start_with?(prefix)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -56,6 +56,5 @@ describe "VagrantPlugins::GuestLinux::Cap::NetworkInterfaces" do
|
||||||
result = cap.network_interfaces(machine)
|
result = cap.network_interfaces(machine)
|
||||||
expect(result).to eq(["enp0s3", "enp0s5", "enp0s8", "bridge0", "docker0"])
|
expect(result).to eq(["enp0s3", "enp0s5", "enp0s8", "bridge0", "docker0"])
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue