diff options
author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-22 11:53:30 -0700 |
---|---|---|
committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-22 15:39:06 -0700 |
commit | f77304b703cbaaf5b46b974a0c80b73cece4a2aa (patch) | |
tree | dca46a71880832bbf91c6ad99c5264681546ae68 /spec/lib/puppet | |
parent | 435c826ead5c81c3eb7c47efe9c52e2e77c14666 (diff) | |
download | puppet-f77304b703cbaaf5b46b974a0c80b73cece4a2aa.tar.gz puppet-f77304b703cbaaf5b46b974a0c80b73cece4a2aa.tar.xz puppet-f77304b703cbaaf5b46b974a0c80b73cece4a2aa.zip |
(#7157) Return a non-zero exit code on face failure.
When a face or action fails we should exit non-zero on the CLI to signal this
to our caller. "Fails" is defined as "raises an exception"; we don't treat
any return value as a significant failure.
Reviewed-By: Jesse Wolf <jesse@puppetlabs.com>
Diffstat (limited to 'spec/lib/puppet')
-rwxr-xr-x | spec/lib/puppet/face/basetest.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/lib/puppet/face/basetest.rb b/spec/lib/puppet/face/basetest.rb index 9a658b685..a98bc382f 100755 --- a/spec/lib/puppet/face/basetest.rb +++ b/spec/lib/puppet/face/basetest.rb @@ -1,3 +1,33 @@ +require 'puppet/face' + Puppet::Face.define(:basetest, '0.0.1') do summary "This is just so tests don't fail" + + option "--[no-]boolean" + option "--mandatory ARGUMENT" + + action :foo do + option("--action") + when_invoked do |*args| args.length end + end + + action :return_true do + summary "just returns true" + when_invoked do |options| true end + end + + action :return_false do + summary "just returns false" + when_invoked do |options| false end + end + + action :return_nil do + summary "just returns nil" + when_invoked do |options| nil end + end + + action :raise do + summary "just raises an exception" + when_invoked do |options| raise ArgumentError, "your failure" end + end end |