diff options
author | Morgan Haskel <morgan@puppetlabs.com> | 2015-02-19 11:33:34 -0800 |
---|---|---|
committer | Morgan Haskel <morgan@puppetlabs.com> | 2015-02-19 11:33:34 -0800 |
commit | fcd2f53908e5f4d4c3396cd56593473c3095453d (patch) | |
tree | 42096aa0922259f42c774b987884cf16c59bcac6 | |
parent | ad5727266a5c243cebf8007b9b00ffc80674b4fc (diff) | |
parent | 1321d586a88edb7c8bf07c5edb2d5ce2ae44c1a3 (diff) | |
download | puppet-stdlib-fcd2f53908e5f4d4c3396cd56593473c3095453d.tar.gz puppet-stdlib-fcd2f53908e5f4d4c3396cd56593473c3095453d.tar.bz2 |
Merge pull request #412 from seanmil/MODULES-1771
(MODULES-1771) Don't modify input to is_domain_name()
-rw-r--r-- | lib/puppet/parser/functions/is_domain_name.rb | 2 | ||||
-rwxr-xr-x | spec/functions/is_domain_name_spec.rb | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/puppet/parser/functions/is_domain_name.rb b/lib/puppet/parser/functions/is_domain_name.rb index b3fee96..24cc208 100644 --- a/lib/puppet/parser/functions/is_domain_name.rb +++ b/lib/puppet/parser/functions/is_domain_name.rb @@ -13,7 +13,7 @@ Returns true if the string passed to this function is a syntactically correct do "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 4d05f5c..5ab8369 100755 --- a/spec/functions/is_domain_name_spec.rb +++ b/spec/functions/is_domain_name_spec.rb @@ -61,4 +61,11 @@ describe "the is_domain_name function" do 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 |