diff options
| author | Luke Kanies <luke@madstop.com> | 2005-07-19 18:49:57 +0000 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2005-07-19 18:49:57 +0000 |
| commit | 3a67efa703f2e1db49d7a213e56a72cc5885fbba (patch) | |
| tree | f5fbc4e2a877615bed15eedd8721147843151eb3 /lib/puppet | |
| parent | de91dbdc5c554136437250daa512050f6d46fbc8 (diff) | |
| download | puppet-3a67efa703f2e1db49d7a213e56a72cc5885fbba.tar.gz puppet-3a67efa703f2e1db49d7a213e56a72cc5885fbba.tar.xz puppet-3a67efa703f2e1db49d7a213e56a72cc5885fbba.zip | |
adding "=" to metaparam methods, and allowing types to use methods for params
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@422 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet')
| -rw-r--r-- | lib/puppet/type.rb | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index d5dafcd38..e32754914 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -419,7 +419,7 @@ class Type < Puppet::Element if Puppet::Type.metaparam?(mname) # call the metaparam method - self.send(("meta" + mname.id2name),value) + self.send(("meta" + mname.id2name + "="),value) elsif stateklass = self.class.validstate?(mname) if value.is_a?(Puppet::State) Puppet.debug "'%s' got handed a state for '%s'" % [self,mname] @@ -439,7 +439,14 @@ class Type < Puppet::Element end end elsif self.class.validparameter?(mname) - @parameters[mname] = value + # if they've got a method to handle the parameter, then do it that way + method = "param" + mname.id2name + "=" + if self.respond_to?(method) + self.send(method,value) + else + # else just set it + @parameters[mname] = value + end else raise "Invalid parameter %s" % [mname] end @@ -786,7 +793,7 @@ class Type < Puppet::Element #--------------------------------------------------------------- # this just marks states that we definitely want to retrieve values # on - def metacheck(args) + def metacheck=(args) unless args.is_a?(Array) args = [args] end @@ -850,7 +857,7 @@ class Type < Puppet::Element # for each object we require, subscribe to all events that it # generates # we might reduce the level of subscription eventually, but for now... - def metarequire(requires) + def metarequire=(requires) unless requires.is_a?(Array) requires = [requires] end @@ -882,14 +889,14 @@ class Type < Puppet::Element #--------------------------------------------------------------- #--------------------------------------------------------------- - def metaonerror(response) + def metaonerror=(response) Puppet.debug("Would have called metaonerror") @onerror = response end #--------------------------------------------------------------- #--------------------------------------------------------------- - def metaschedule(schedule) + def metaschedule=(schedule) @schedule = schedule end #--------------------------------------------------------------- |
