diff options
author | Brice Figureau <brice-puppet@daysofwonder.com> | 2009-09-15 21:01:48 +0200 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-09-17 13:54:55 +1000 |
commit | 361c50210172ffe484550a19db3a8d10d86edc09 (patch) | |
tree | 24b43a67b76164a852c195cb9b05bc27c6a56a49 /lib | |
parent | 2283605ba63b39deec30bd71b5d0879630f63e6d (diff) | |
download | puppet-361c50210172ffe484550a19db3a8d10d86edc09.tar.gz puppet-361c50210172ffe484550a19db3a8d10d86edc09.tar.xz puppet-361c50210172ffe484550a19db3a8d10d86edc09.zip |
Fix #2638 - Allow creating several nodes with matching names
When we are checking if a node exists before creating a new one
we were also trying to match with regex node names, finding matches
where in fact there is no equality.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/parser/loaded_code.rb | 4 | ||||
-rw-r--r-- | lib/puppet/parser/parser_support.rb | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/puppet/parser/loaded_code.rb b/lib/puppet/parser/loaded_code.rb index 065fcb99c..3efd115bc 100644 --- a/lib/puppet/parser/loaded_code.rb +++ b/lib/puppet/parser/loaded_code.rb @@ -36,6 +36,10 @@ class Puppet::Parser::LoadedCode nil end + def node_exists?(name) + @nodes[check_name(name)] + end + def nodes? @nodes.length > 0 end diff --git a/lib/puppet/parser/parser_support.rb b/lib/puppet/parser/parser_support.rb index dfc14e0c9..4fe2a5a0d 100644 --- a/lib/puppet/parser/parser_support.rb +++ b/lib/puppet/parser/parser_support.rb @@ -376,7 +376,7 @@ class Puppet::Parser::Parser doc = lexer.getcomment names.collect do |name| name = AST::HostName.new :value => name unless name.is_a?(AST::HostName) - if other = @loaded_code.node(name) + if other = @loaded_code.node_exists?(name) error("Node %s is already defined at %s:%s; cannot redefine" % [other.name, other.file, other.line]) end name = name.to_s if name.is_a?(Symbol) |