summaryrefslogtreecommitdiff
path: root/lib/puppet/parser
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/functions/is_valid_mac_address.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions/is_valid_mac_address.rb b/lib/puppet/parser/functions/is_valid_mac_address.rb
index 0b91d0d..a00d874 100644
--- a/lib/puppet/parser/functions/is_valid_mac_address.rb
+++ b/lib/puppet/parser/functions/is_valid_mac_address.rb
@@ -12,6 +12,14 @@ module Puppet::Parser::Functions
"given #{arguments.size} for 1")
end
+ mac = arguments[0]
+
+ if /^[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}:[a-fA-F0-9]{1,2}$/.match(mac) then
+ return true
+ else
+ return false
+ end
+
end
end