summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-03-10 13:34:38 -0700
committerLuke Kanies <luke@madstop.com>2008-03-24 15:02:25 -0500
commit4bfc4efd969b01843137a6c51591435d05c19c5f (patch)
treed7a08dbd1a54428007b0331ade46a02bf0671994 /lib
parentd93e1b4696978614a02ff02d24857c9e7c8cce15 (diff)
downloadpuppet-4bfc4efd969b01843137a6c51591435d05c19c5f.tar.gz
puppet-4bfc4efd969b01843137a6c51591435d05c19c5f.tar.xz
puppet-4bfc4efd969b01843137a6c51591435d05c19c5f.zip
Modifying the way ensure is handled so that it supports
having it be a parameter. This is only useful if you want a composite resource that just generates other resources and passes the value on.
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/metatype/evaluation.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/puppet/metatype/evaluation.rb b/lib/puppet/metatype/evaluation.rb
index 36328c537..8d435333f 100644
--- a/lib/puppet/metatype/evaluation.rb
+++ b/lib/puppet/metatype/evaluation.rb
@@ -125,14 +125,19 @@ class Puppet::Type
# the other properties matter.
changes = []
ensureparam = @parameters[:ensure]
- if @parameters.include?(:ensure) && !currentvalues.include?(ensureparam)
+
+ # This allows resource types to have 'ensure' be a parameter, which allows them to
+ # just pass the parameter on to other generated resources.
+ ensureparam = nil unless ensureparam.is_a?(Puppet::Property)
+ if ensureparam && !currentvalues.include?(ensureparam)
raise Puppet::DevError, "Parameter ensure defined but missing from current values"
end
- if @parameters.include?(:ensure) and ! ensureparam.insync?(currentvalues[ensureparam])
+
+ if ensureparam and ! ensureparam.insync?(currentvalues[ensureparam])
changes << Puppet::PropertyChange.new(ensureparam, currentvalues[ensureparam])
# Else, if the 'ensure' property is correctly absent, then do
# nothing
- elsif @parameters.include?(:ensure) and currentvalues[ensureparam] == :absent
+ elsif ensureparam and currentvalues[ensureparam] == :absent
return []
else
changes = properties().find_all { |property|