diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-15 15:06:53 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-15 15:14:29 -0700 |
| commit | f770325884ebef493cb8ca6060a65355211125b9 (patch) | |
| tree | 8582da4938e8eb0d8ecc9b65f5318fc67fb6a18d /lib/puppet/interface | |
| parent | c00e03d41b0bd1174b51eddf5e593aec3bbdd84d (diff) | |
| download | puppet-f770325884ebef493cb8ca6060a65355211125b9.tar.gz puppet-f770325884ebef493cb8ca6060a65355211125b9.tar.xz puppet-f770325884ebef493cb8ca6060a65355211125b9.zip | |
(#6978) Enforce the calling convention of option hooks.
We require that hooks take exactly three arguments; now we enforce that in the
DSL, to ensure we give good, and early, errors to users who do the wrong
thing.
Paired-With: Max Martin <max@puppetlabs.com>
Diffstat (limited to 'lib/puppet/interface')
| -rw-r--r-- | lib/puppet/interface/option_builder.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/puppet/interface/option_builder.rb b/lib/puppet/interface/option_builder.rb index ccad0850d..d4e59a4df 100644 --- a/lib/puppet/interface/option_builder.rb +++ b/lib/puppet/interface/option_builder.rb @@ -31,6 +31,9 @@ class Puppet::Interface::OptionBuilder if @option.before_action raise ArgumentError, "#{@option} already has a before_action set" end + unless block.arity == 3 then + raise ArgumentError, "before_action takes three arguments, action, args, and options" + end @option.before_action = block end @@ -39,6 +42,9 @@ class Puppet::Interface::OptionBuilder if @option.after_action raise ArgumentError, "#{@option} already has a after_action set" end + unless block.arity == 3 then + raise ArgumentError, "after_action takes three arguments, action, args, and options" + end @option.after_action = block end end |
