summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-05-02 15:54:45 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-05-02 15:54:45 +0000
commite8c912d1cdd56a48370bd47dec83f3ef126c23ea (patch)
tree87b1a6f1071fd51bcbd0dc93b0a4ac6e048bc146
parent37d2850ade3c4e8e94f3abdbc01afc159ed7dbd0 (diff)
downloadpuppet-e8c912d1cdd56a48370bd47dec83f3ef126c23ea.tar.gz
Allowing dashes in class names, although grammar rules restrict it from working anywhere except node names or in tag(). They are valid in host names, and many companies have them in the host names; in fact, this fix is for a company with this exact problem -- they cannot use puppet with their nodes because all their hosts have dashes in the host names.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1165 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r--conf/redhat/puppet.spec2
-rw-r--r--lib/puppet/parser/scope.rb2
-rwxr-xr-xtest/language/scope.rb4
3 files changed, 4 insertions, 4 deletions
diff --git a/conf/redhat/puppet.spec b/conf/redhat/puppet.spec
index b569f56b7..256352a79 100644
--- a/conf/redhat/puppet.spec
+++ b/conf/redhat/puppet.spec
@@ -4,7 +4,7 @@
Summary: A network tool for managing many disparate systems
Name: puppet
-Version: 0.16.3
+Version: 0.16.4
Release: 1%{?dist}
License: GPL
Group: System Environment/Base
diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb
index 7239feb17..394c46033 100644
--- a/lib/puppet/parser/scope.rb
+++ b/lib/puppet/parser/scope.rb
@@ -631,7 +631,7 @@ 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*$/
+ unless name =~ /^[a-z][\w-]*$/
raise Puppet::ParseError, "Invalid class name '%s'" % name
end
diff --git a/test/language/scope.rb b/test/language/scope.rb
index da23c4256..62cded121 100755
--- a/test/language/scope.rb
+++ b/test/language/scope.rb
@@ -550,13 +550,13 @@ class TestScope < Test::Unit::TestCase
def test_validclassnames
scope = Puppet::Parser::Scope.new()
- ["a-class", "a class", "Class", "a.class"].each do |bad|
+ ["a class", "Class", "a.class"].each do |bad|
assert_raise(Puppet::ParseError, "Incorrectly allowed %s" % bad.inspect) do
scope.setclass(object_id, bad)
end
end
- ["a_class", "class", "yayNess"].each do |good|
+ ["a-class", "a_class", "class", "yayNess"].each do |good|
assert_nothing_raised("Incorrectly banned %s" % good.inspect) do
scope.setclass(object_id, good)
end