diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2015-05-22 13:22:45 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-05-26 11:45:53 -0700 |
commit | 2065031ddf42feaeaccb9561469453100fceaddc (patch) | |
tree | 4915e42e975f509ef87b7f4bc0bc0af79ece5bd5 | |
parent | e7d90f9c1cf3cc587d643a25cb74acd209ebcfdb (diff) | |
download | chef-2065031ddf42feaeaccb9561469453100fceaddc.tar.gz |
add shell_out to resources
allows for using shell_out! and friends in not_if/only_if blocks
-rw-r--r-- | lib/chef/resource.rb | 4 | ||||
-rw-r--r-- | spec/unit/resource_spec.rb | 12 |
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index 2f5c2b7798..757cd442af 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -37,6 +37,7 @@ require 'chef/resource_resolver' require 'chef/mixin/deprecation' require 'chef/mixin/provides' +require 'chef/mixin/shell_out' class Chef class Resource @@ -51,6 +52,9 @@ class Chef include Chef::DSL::RebootPending extend Chef::Mixin::Provides + # This lets user code do things like `not_if { shell_out!("command") }` + include Chef::Mixin::ShellOut + # # The node the current Chef run is using. # diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index 0479778f55..3bfd63f5ab 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -35,6 +35,18 @@ describe Chef::Resource do @resource = Chef::Resource.new("funk", @run_context) end + it "should mixin shell_out" do + expect(@resource.respond_to?(:shell_out)).to be true + end + + it "should mixin shell_out!" do + expect(@resource.respond_to?(:shell_out!)).to be true + end + + it "should mixin shell_out_with_systems_locale" do + expect(@resource.respond_to?(:shell_out_with_systems_locale)).to be true + end + describe "when inherited" do it "adds an entry to a list of subclasses" do |