diff --git a/lib/puppet/parser/functions/is_domain_name.rb b/lib/puppet/parser/functions/is_domain_name.rb index b3fee965a..24cc2085f 100644 --- a/lib/puppet/parser/functions/is_domain_name.rb +++ b/lib/puppet/parser/functions/is_domain_name.rb @@ -13,7 +13,7 @@ module Puppet::Parser::Functions "given #{arguments.size} for 1") end - domain = arguments[0] + domain = arguments[0].dup # Limits (rfc1035, 3.1) domain_max_length=255 diff --git a/spec/functions/is_domain_name_spec.rb b/spec/functions/is_domain_name_spec.rb index 4d05f5cdc..5ab8369c0 100755 --- a/spec/functions/is_domain_name_spec.rb +++ b/spec/functions/is_domain_name_spec.rb @@ -61,4 +61,11 @@ result = scope.function_is_domain_name(["not valid"]) expect(result).to(be_falsey) end + + # Values obtained from Facter values will be frozen strings + # in newer versions of Facter: + it "should not throw an exception if passed a frozen string" do + result = scope.function_is_domain_name(["my.domain.name".freeze]) + expect(result).to(be_truthy) + end end