From 56a402e6542105ec63c5071e685d5af93fd4d0f3 Mon Sep 17 00:00:00 2001 From: Ken Barber Date: Fri, 29 Jul 2011 20:08:31 +0100 Subject: (#2) unstub is_valid_domain_name --- lib/puppet/parser/functions/is_valid_domain_name.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/puppet/parser/functions') diff --git a/lib/puppet/parser/functions/is_valid_domain_name.rb b/lib/puppet/parser/functions/is_valid_domain_name.rb index c0b319c..99d6f86 100644 --- a/lib/puppet/parser/functions/is_valid_domain_name.rb +++ b/lib/puppet/parser/functions/is_valid_domain_name.rb @@ -12,6 +12,14 @@ module Puppet::Parser::Functions "given #{arguments.size} for 1") end + domain = arguments[0] + + if domain =~ /^(([a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])\.?$/ then + return true + else + return false + end + end end -- cgit v1.2.3