diff options
author | Brice Figureau <brice-puppet@daysofwonder.com> | 2009-09-13 23:00:41 +0200 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-09-16 07:17:24 +1000 |
commit | d21b2664abcb13df2967af8caa881e41b19b3b81 (patch) | |
tree | c25231e0151c1fc78151ce0faaf5a06515f0d08b /spec | |
parent | cb90528c041b63c1c483ac8650d1d9c67a12d791 (diff) | |
download | puppet-d21b2664abcb13df2967af8caa881e41b19b3b81.tar.gz puppet-d21b2664abcb13df2967af8caa881e41b19b3b81.tar.xz puppet-d21b2664abcb13df2967af8caa881e41b19b3b81.zip |
Fix #2627 - regex node name could lead to invalid tag
We're converting the regex to a straight name to be used as the node
class name which later on will be used as tag.
It was possible to generate an invalid tag name (containing leading
or successive dots).
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'spec')
-rwxr-xr-x | spec/unit/parser/ast/leaf.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/unit/parser/ast/leaf.rb b/spec/unit/parser/ast/leaf.rb index 6215f6345..69b704ad8 100755 --- a/spec/unit/parser/ast/leaf.rb +++ b/spec/unit/parser/ast/leaf.rb @@ -200,6 +200,11 @@ describe Puppet::Parser::AST::HostName do host.to_classname.should == "this-isnotaclassname" end + it "should return a string usable as a tag when calling to_classname" do + host = Puppet::Parser::AST::HostName.new( :value => Puppet::Parser::AST::Regex.new(:value => "/.+.reductivelabs\.com/") ) + host.to_classname.should == "reductivelabs.com" + end + it "should delegate 'match' to the underlying value if it is an HostName" do @value.expects(:match).with("value") @host.match("value") |