From bd973a2eeb9cc161553b47974b3e88c3343e4ce3 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Fri, 27 Aug 2010 16:00:21 -0700 Subject: Fix for #4637 --use of namevar missed in refactor A use of namevar apparently slipped through the net or got (re)introduced in a merge/conflict resolution. --- lib/puppet/application/describe.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/puppet') diff --git a/lib/puppet/application/describe.rb b/lib/puppet/application/describe.rb index 5abe3ea14..e76b347f6 100644 --- a/lib/puppet/application/describe.rb +++ b/lib/puppet/application/describe.rb @@ -130,7 +130,7 @@ class TypeDoc a[0].to_s <=> b[0].to_s }.each { |name, doc| print "\n- **#{name}**" - if type.namevar == name and name != :name + if type.key_attributes.include?(name) and name != :name puts " (*namevar*)" else puts "" -- cgit From 14b33402812756dc0cd3e84619afa211d449d59f Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Fri, 10 Sep 2010 18:18:55 -0700 Subject: Fix for #4736 -- preserve case of defined resources This restricts the change introduced in #4691 to hostclasses, and leaves defined resources and nodes alone, thus more closely mimicing the 0.25.x behaviour. It also includes title, as this was similarly affected. --- lib/puppet/resource/type.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/puppet') diff --git a/lib/puppet/resource/type.rb b/lib/puppet/resource/type.rb index 1d378aaa6..7b21e55dc 100644 --- a/lib/puppet/resource/type.rb +++ b/lib/puppet/resource/type.rb @@ -233,8 +233,13 @@ class Puppet::Resource::Type resource[param] = value end - scope.setvar("title", resource.title) unless set.include? :title - scope.setvar("name", resource.name.to_s.downcase) unless set.include? :name + if @type == :hostclass + scope.setvar("title", resource.title.to_s.downcase) unless set.include? :title + scope.setvar("name", resource.name.to_s.downcase ) unless set.include? :name + else + scope.setvar("title", resource.title ) unless set.include? :title + scope.setvar("name", resource.name ) unless set.include? :name + end scope.setvar("module_name", module_name) if module_name and ! set.include? :module_name if caller_name = scope.parent_module_name and ! set.include?(:caller_module_name) -- cgit From 9bdfe694bc6c60a48b45f8dd49c20c6da31445f7 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Sat, 11 Sep 2010 10:23:38 -0500 Subject: Fix for Bug #4756 - Providers no longer respect missing features Restored deleted lines from type.rb and reinstated unit tests --- lib/puppet/type.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/puppet') diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 291179a02..ccb2b492a 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -472,6 +472,12 @@ class Type raise Puppet::Error, "Resource type #{self.class.name} does not support parameter #{name}" end + if provider and ! provider.class.supports_parameter?(klass) + missing = klass.required_features.find_all { |f| ! provider.class.feature?(f) } + info "Provider %s does not support features %s; not managing attribute %s" % [provider.class.name, missing.join(", "), name] + return nil + end + return @parameters[name] if @parameters.include?(name) @parameters[name] = klass.new(:resource => self) -- cgit From 14f871d6a9cad5c3eda10da005a97ed8aba9e991 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Mon, 13 Sep 2010 18:11:31 -0700 Subject: [#4756] addendum for #4756 This fixes spec and unit tests indirectly related to the previous patch-revert. One failure was from trying to test the User Type's roles, when, on many platforms, the roles feature wasn't supported by the default Provider. Other tests could fail on some platforms because they assumed that unsupported attributes would be ignored with a warning, but the code was crashing instead. --- lib/puppet/type.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'lib/puppet') diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index ccb2b492a..f9aacece8 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -410,13 +410,15 @@ class Type property = self.newattr(name) - begin - # make sure the parameter doesn't have any errors - property.value = value - rescue => detail - error = Puppet::Error.new("Parameter #{name} failed: #{detail}") - error.set_backtrace(detail.backtrace) - raise error + if property + begin + # make sure the parameter doesn't have any errors + property.value = value + rescue => detail + error = Puppet::Error.new("Parameter #{name} failed: #{detail}") + error.set_backtrace(detail.backtrace) + raise error + end end nil -- cgit