diff options
| author | Jesse Wolfe <jes5199@gmail.com> | 2010-06-15 14:15:16 -0700 |
|---|---|---|
| committer | Jesse Wolfe <jes5199@gmail.com> | 2010-06-21 14:15:25 -0700 |
| commit | 7c6b8836453b2b1e8679923f98854be3b0022edd (patch) | |
| tree | 38f3f3af93a3e8b047635cb59a2b2908f885d38f /lib/puppet/parser | |
| parent | 2396ebac9021eaa4a2983e60902c04cc9e0db0ee (diff) | |
| download | puppet-7c6b8836453b2b1e8679923f98854be3b0022edd.tar.gz puppet-7c6b8836453b2b1e8679923f98854be3b0022edd.tar.xz puppet-7c6b8836453b2b1e8679923f98854be3b0022edd.zip | |
[#1621] Composite keys for resources
This patch implements the fundamental pieces of the move to composite
keys:
* Instead of having a single namevar, we have a non-empty collection
of them, and two resources are the same if and only if all of them
match. Note that the present situation is a special case of this,
where the collection always has exactly one member.
* As currently, namevar is determined by the type.
* Instead just of inferring the single namevar from the title we let
types decompose the title into values for several (perhaps all) of
the namevar components; note that the present situation is again a
special case of this.
Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'lib/puppet/parser')
| -rw-r--r-- | lib/puppet/parser/compiler.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/parser/resource.rb | 7 |
2 files changed, 2 insertions, 7 deletions
diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb index beba438a9..f869383dc 100644 --- a/lib/puppet/parser/compiler.rb +++ b/lib/puppet/parser/compiler.rb @@ -446,7 +446,7 @@ class Puppet::Parser::Compiler @catalog.version = known_resource_types.version # Create our initial scope and a resource that will evaluate main. - @topscope = Puppet::Parser::Scope.new(:compiler => self) + @topscope = Puppet::Parser::Scope.new(:compiler => self, :source => 'implicit') @main_stage_resource = Puppet::Parser::Resource.new("stage", :main, :scope => @topscope) @catalog.add_resource(@main_stage_resource) diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb index f221979df..fd2f49264 100644 --- a/lib/puppet/parser/resource.rb +++ b/lib/puppet/parser/resource.rb @@ -144,13 +144,8 @@ class Puppet::Parser::Resource < Puppet::Resource ! (catalog and version = catalog.client_version and version = version.split(".") and version[0] == "0" and version[1].to_i >= 25) end - # Return the resource name, or the title if no name - # was specified. def name - unless defined? @name - @name = self[:name] || self.title - end - @name + self[:name] || self.title end def namespaces |
