diff options
author | Pieter van de Bruggen <pieter@puppetlabs.com> | 2011-04-29 12:18:12 -0700 |
---|---|---|
committer | Pieter van de Bruggen <pieter@puppetlabs.com> | 2011-04-29 12:25:46 -0700 |
commit | 207deae2dc06ca439e3b5ee9b044221a1c2899bb (patch) | |
tree | 3dcbc0c601dd7757fb0a865cc222ac97ded8b0d2 /lib/puppet/interface/action.rb | |
parent | 1aaf5fdc51e165c7d0f377450016cd4fb3767c02 (diff) | |
download | puppet-207deae2dc06ca439e3b5ee9b044221a1c2899bb.tar.gz puppet-207deae2dc06ca439e3b5ee9b044221a1c2899bb.tar.xz puppet-207deae2dc06ca439e3b5ee9b044221a1c2899bb.zip |
(#7289) Specify order for option decorations.
`before_action` decorations should always resolve in resolution order
from most general (inherited from furthest away) to most specific
(declared on the instance), and should always execute Face-level
option decorations before action-level option decorations.
`after_action` decorations should execute in the opposite order.
Reviewed-By: Daniel Pittman
Diffstat (limited to 'lib/puppet/interface/action.rb')
-rw-r--r-- | lib/puppet/interface/action.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/puppet/interface/action.rb b/lib/puppet/interface/action.rb index 464b2a738..96bb5b438 100644 --- a/lib/puppet/interface/action.rb +++ b/lib/puppet/interface/action.rb @@ -9,7 +9,10 @@ class Puppet::Interface::Action @name = name.to_sym attrs.each do |k, v| send("#{k}=", v) end - @options = {} + # @options collects the added options in the order they're declared. + # @options_hash collects the options keyed by alias for quick lookups. + @options = [] + @options_hash = {} @when_rendering = {} end @@ -211,22 +214,23 @@ WRAPPER end option.aliases.each do |name| - @options[name] = option + @options << name + @options_hash[name] = option end option end def option?(name) - @options.include? name.to_sym + @options_hash.include? name.to_sym end def options - (@options.keys + @face.options).sort + @face.options + @options end def get_option(name, with_inherited_options = true) - option = @options[name.to_sym] + option = @options_hash[name.to_sym] if option.nil? and with_inherited_options option = @face.get_option(name) end |