lib/puppet/parser/ast/leaf.rb in puppet-0.13.6 vs lib/puppet/parser/ast/leaf.rb in puppet-0.16.0

- old
+ new

@@ -67,9 +67,21 @@ class Type < AST::Leaf; end # Lower-case words. class Name < AST::Leaf; end + # Host names, either fully qualified or just the short name + 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. class Variable < Name # Looks up the value of the object in the scope tree (does # not include syntactical constructs, like '$' and '{}').