summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPieter van de Bruggen <pieter@puppetlabs.com>2011-04-26 16:47:55 -0700
committerPieter van de Bruggen <pieter@puppetlabs.com>2011-04-26 16:47:55 -0700
commit1aaf5fdc51e165c7d0f377450016cd4fb3767c02 (patch)
tree4f0d014d232a2eec850b704c177b31f4b879e95e
parentcd035426848154e8d11db5c59657d1b74258c9a0 (diff)
parentc627fad08c4866fbef300e887750c29963985635 (diff)
downloadpuppet-1aaf5fdc51e165c7d0f377450016cd4fb3767c02.tar.gz
puppet-1aaf5fdc51e165c7d0f377450016cd4fb3767c02.tar.xz
puppet-1aaf5fdc51e165c7d0f377450016cd4fb3767c02.zip
Merge branch 'tickets/2.7.x/7251' into 2.7.x
-rw-r--r--lib/puppet/interface.rb8
-rw-r--r--lib/puppet/interface/action.rb2
-rwxr-xr-xspec/unit/interface/action_spec.rb4
3 files changed, 6 insertions, 8 deletions
diff --git a/lib/puppet/interface.rb b/lib/puppet/interface.rb
index ced00863d..ba68ac65b 100644
--- a/lib/puppet/interface.rb
+++ b/lib/puppet/interface.rb
@@ -139,12 +139,10 @@ class Puppet::Interface
action.get_option(name).__decoration_name(type)
end
+ # Exceptions here should propagate up; this implements a hook we can use
+ # reasonably for option validation.
methods.each do |hook|
- begin
- respond_to? hook and self.__send__(hook, action, passed_args, passed_options)
- rescue => e
- Puppet.warning("invoking #{action} #{type} hook: #{e}")
- end
+ respond_to? hook and self.__send__(hook, action, passed_args, passed_options)
end
end
diff --git a/lib/puppet/interface/action.rb b/lib/puppet/interface/action.rb
index 08bc0a345..464b2a738 100644
--- a/lib/puppet/interface/action.rb
+++ b/lib/puppet/interface/action.rb
@@ -239,7 +239,7 @@ WRAPPER
end.select(&:required?).collect(&:name) - args.last.keys
return if required.empty?
- raise ArgumentError, "missing required options (#{required.join(', ')})"
+ raise ArgumentError, "The following options are required: #{required.join(', ')}"
end
########################################################################
diff --git a/spec/unit/interface/action_spec.rb b/spec/unit/interface/action_spec.rb
index 24826a6ef..23d0de490 100755
--- a/spec/unit/interface/action_spec.rb
+++ b/spec/unit/interface/action_spec.rb
@@ -237,7 +237,7 @@ describe Puppet::Interface::Action do
when_invoked { }
end
end
- expect { face.bar }.to raise_error ArgumentError, /missing required options \(foo\)/
+ expect { face.bar }.to raise_error ArgumentError, /The following options are required: foo/
end
it "should fail when a required face option is not provided" do
@@ -245,7 +245,7 @@ describe Puppet::Interface::Action do
option('--foo') { required }
action(:bar) { when_invoked { } }
end
- expect { face.bar }.to raise_error ArgumentError, /missing required options \(foo\)/
+ expect { face.bar }.to raise_error ArgumentError, /The following options are required: foo/
end
end