From c62bb666679f35fb8b7305ac94620a8f99a5b322 Mon Sep 17 00:00:00 2001 From: Dan Radez Date: Thu, 25 Jan 2018 11:27:58 -0500 Subject: [PATCH] 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 --- lib/puppet/parser/functions/interface_for_ip.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/puppet/parser/functions/interface_for_ip.rb b/lib/puppet/parser/functions/interface_for_ip.rb index fd68be0c2..b0963c487 100644 --- a/lib/puppet/parser/functions/interface_for_ip.rb +++ b/lib/puppet/parser/functions/interface_for_ip.rb @@ -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}"