summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-04-11 17:48:14 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-04-11 17:48:14 +0000
commit373fb3b57c9edafc1935789d7b5cb99d45656f2e (patch)
treecebfba070aafef332bb0ea49b758cbeed5cb41d9 /lib/puppet/parser
parent8df349c61314d5bf0acc0402f90bb5399014d442 (diff)
downloadpuppet-373fb3b57c9edafc1935789d7b5cb99d45656f2e.tar.gz
puppet-373fb3b57c9edafc1935789d7b5cb99d45656f2e.tar.xz
puppet-373fb3b57c9edafc1935789d7b5cb99d45656f2e.zip
Modifying "setclass" on scope to check the validity of class names, now that "set" can be used to set them manually, and added a test for it.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1104 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/scope.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb
index 27de8ffd8..7239feb17 100644
--- a/lib/puppet/parser/scope.rb
+++ b/lib/puppet/parser/scope.rb
@@ -631,6 +631,10 @@ module Puppet::Parser
# hash. We store the object ID, not class name, so that we
# can support multiple unrelated classes with the same name.
def setclass(id, name)
+ unless name =~ /^[a-z]\w*$/
+ raise Puppet::ParseError, "Invalid class name '%s'" % name
+ end
+
if self.topscope?
@classtable[id] = name
else