From c0a9e5f2e9df8e6e1aed74653ae675029af8a9bb Mon Sep 17 00:00:00 2001 From: lutter Date: Tue, 4 Apr 2006 19:57:54 +0000 Subject: Change how names for nodes are specified: the 'node' keyword can be followed by a NAME or by single quoted text, i.e. fully qualified names for nodes must be enclosed in single quotes git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1064 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/parser/ast/leaf.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib/puppet/parser/ast') diff --git a/lib/puppet/parser/ast/leaf.rb b/lib/puppet/parser/ast/leaf.rb index eeeee45fd..609bcd3cc 100644 --- a/lib/puppet/parser/ast/leaf.rb +++ b/lib/puppet/parser/ast/leaf.rb @@ -70,7 +70,16 @@ class Puppet::Parser::AST class Name < AST::Leaf; end # Host names, either fully qualified or just the short name - class HostName < AST::Leaf; end + class HostName < AST::Leaf + def initialize(hash) + super + + unless @value =~ %r{^[0-9a-zA-Z\-]+(\.[0-9a-zA-Z\-]+)*$} + raise Puppet::DevError, + "'%s' is not a valid hostname" % @value + end + end + end # A simple variable. This object is only used during interpolation; # the VarDef class is used for assignment. -- cgit