Check that name for aliases matches pattern
authorDan Bode <bodepd@gmail.com>
Tue, 2 Nov 2010 14:50:56 +0000 (09:50 -0500)
committerDan Bode <bodepd@gmail.com>
Tue, 2 Nov 2010 14:50:56 +0000 (09:50 -0500)
lib/puppet/type/sudoers.rb

index 73810e9..890bffa 100644 (file)
@@ -187,6 +187,9 @@ Defaults@host x=y,one=1,two=2
         checkprops(SUDOERS_DEFAULT)      
       elsif self.value(:type) == 'alias'
         checkprops(SUDOERS_ALIAS)      
+        unless self[:name] =~ /^[A-Z]([A-Z]|[0-9]|_)*$/
+          raise Puppet::Error, "alias names #{self[:name]} does not match [A-Z]([A-Z][0-9]_)*"
+        end
       elsif self.value(:type) == 'user_spec'
         checkprops(SUDOERS_SPEC)      
       elsif ! self[:type]