Ensure interface names are downcased

https://tickets.puppetlabs.com/browse/FACT-777
Puppet downcases fact names so they names don't become Types
Interfaces can have Uppercase letters in them.

Closes-Bug: #1745448

Change-Id: I03fd5c103f4b4d4c90770f4d8aa26ae8eeeecdcd
This commit is contained in:
Dan Radez 2018-01-25 11:27:58 -05:00 committed by Brent Eagles
parent 7687333445
commit c62bb66667

View File

@ -11,7 +11,8 @@ module Puppet::Parser::Functions
ip1 = IPAddr.new(arg[0])
Dir.foreach('/sys/class/net/') do |interface|
next if interface == '.' || interface == '..'
iface_no_dash = interface.gsub('-', '_')
# puppet downcases fact names, interface names can have capitals
iface_no_dash = interface.gsub('-', '_').downcase
if ip1.ipv4?
ipaddress_name = "ipaddress_#{iface_no_dash}"