diff options
author | Matt Robinson <matt@puppetlabs.com> | 2011-01-21 14:07:32 -0800 |
---|---|---|
committer | Matt Robinson <matt@puppetlabs.com> | 2011-01-24 16:44:41 -0800 |
commit | 3cfbd0722c5f64a3ef39a65f53fa4195135e90b4 (patch) | |
tree | a4d7e75ee14d9396c22839debeabb442d4f47dd7 /lib | |
parent | a2036ea693996cb6ba5eb9f8f52fefa843a320a6 (diff) | |
download | puppet-3cfbd0722c5f64a3ef39a65f53fa4195135e90b4.tar.gz puppet-3cfbd0722c5f64a3ef39a65f53fa4195135e90b4.tar.xz puppet-3cfbd0722c5f64a3ef39a65f53fa4195135e90b4.zip |
(#5045) Cleaning up some tests and code
Renamed some variables to be clearer, made tests use less stubbing,
added some additional tests and got rid of some unecessary logic.
Paired-with: Dan Bode
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/parser/compiler.rb | 2 | ||||
-rw-r--r-- | lib/puppet/resource/type.rb | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb index 3134e03d9..fdabd05c9 100644 --- a/lib/puppet/parser/compiler.rb +++ b/lib/puppet/parser/compiler.rb @@ -153,7 +153,7 @@ class Puppet::Parser::Compiler if param_classes resource = klass.ensure_in_catalog(scope, param_classes[name] || {}) else - found << name and next if scope.class_scope(klass) and !param_classes + found << name and next if scope.class_scope(klass) resource = klass.ensure_in_catalog(scope) end diff --git a/lib/puppet/resource/type.rb b/lib/puppet/resource/type.rb index a31795a1b..92e1ef719 100644 --- a/lib/puppet/resource/type.rb +++ b/lib/puppet/resource/type.rb @@ -143,23 +143,23 @@ class Puppet::Resource::Type # classes and nodes. No parameters are be supplied--if this is a # parameterized class, then all parameters take on their default # values. - def ensure_in_catalog(scope, attributes=nil) + def ensure_in_catalog(scope, parameters=nil) type == :definition and raise ArgumentError, "Cannot create resources for defined resource types" resource_type = type == :hostclass ? :class : :node # Do nothing if the resource already exists; this makes sure we don't # get multiple copies of the class resource, which helps provide the # singleton nature of classes. - # we should not do this for classes with attributes - # if attributes are passed, we should still try to create the resource + # we should not do this for classes with parameters + # if parameters are passed, we should still try to create the resource # even if it exists so that we can fail # this prevents us from being able to combine param classes with include - if resource = scope.catalog.resource(resource_type, name) and !attributes + if resource = scope.catalog.resource(resource_type, name) and !parameters return resource end resource = Puppet::Parser::Resource.new(resource_type, name, :scope => scope, :source => self) - if attributes - attributes.each do |k,v| + if parameters + parameters.each do |k,v| resource.set_parameter(k,v) end end |