From a1bf510ef8f31920bfa39b180acf1c85ed87a8fd Mon Sep 17 00:00:00 2001 From: Jonathan Boyett Date: Mon, 11 Jul 2011 10:18:20 -0700 Subject: [PATCH] ensure the name parameter starts with a digit --- lib/puppet/type/firewall.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/puppet/type/firewall.rb b/lib/puppet/type/firewall.rb index 078d2bf..7dbbe9f 100644 --- a/lib/puppet/type/firewall.rb +++ b/lib/puppet/type/firewall.rb @@ -26,10 +26,14 @@ Puppet::Type.newtype(:firewall) do # Keep rule names simple validate do |value| - if value !~ /^[a-zA-Z0-9 \-_]+$/ then + if value !~ /[a-zA-Z0-9 \-_]+/ self.fail "Not a valid rule name. Make sure it contains ASCII " \ "alphanumeric, spaces, hyphens or underscores." end + + if value !~ /^\d+/ + self.fail 'Not a valid rule name. Rules names must start with a digit' + end end end -- 2.45.2