From: Jonathan Boyett <jonathan@failingservers.com> Date: Mon, 11 Jul 2011 17:18:20 +0000 (-0700) Subject: ensure the name parameter starts with a digit X-Git-Tag: v0.0.1~24 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=a1bf510ef8f31920bfa39b180acf1c85ed87a8fd;p=puppet-modules%2Fpuppetlabs-firewall.git ensure the name parameter starts with a digit --- 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