diff options
author | Julian C. Dunn <jdunn@chef.io> | 2015-08-06 23:10:00 -0400 |
---|---|---|
committer | Julian C. Dunn <jdunn@chef.io> | 2015-08-06 23:10:00 -0400 |
commit | 1cd881fed9af620e51dd9040d3d17b1938ae82ac (patch) | |
tree | f6d3a1cdab715949ed258a84b0ed36d0b478b805 | |
parent | 57836b6f57ae09c5de8f37ca84c0dab7f3e1b06e (diff) | |
download | chef-1cd881fed9af620e51dd9040d3d17b1938ae82ac.tar.gz |
Don't use shell_out! on "lssrc -g" as it will raise an exception if the service is not a group.
-rw-r--r-- | lib/chef/provider/service/aix.rb | 2 | ||||
-rw-r--r-- | spec/unit/provider/service/aix_service_spec.rb | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/chef/provider/service/aix.rb b/lib/chef/provider/service/aix.rb index 09ed4bbf01..0c95ce2c8e 100644 --- a/lib/chef/provider/service/aix.rb +++ b/lib/chef/provider/service/aix.rb @@ -116,7 +116,7 @@ class Chef end def is_resource_group? - so = shell_out!("lssrc -g #{@new_resource.service_name}") + so = shell_out("lssrc -g #{@new_resource.service_name}") if so.exitstatus == 0 Chef::Log.debug("#{@new_resource.service_name} is a group") @is_resource_group = true diff --git a/spec/unit/provider/service/aix_service_spec.rb b/spec/unit/provider/service/aix_service_spec.rb index a0c8bb3407..5cca7d6f0a 100644 --- a/spec/unit/provider/service/aix_service_spec.rb +++ b/spec/unit/provider/service/aix_service_spec.rb @@ -94,7 +94,7 @@ describe Chef::Provider::Service::Aix do end it "service is a group" do - expect(@provider).to receive(:shell_out!).with("lssrc -g chef").and_return(@status) + expect(@provider).to receive(:shell_out).with("lssrc -g chef").and_return(@status) @provider.load_current_resource expect(@provider.instance_eval("@is_resource_group")).to be_truthy end @@ -106,7 +106,7 @@ describe Chef::Provider::Service::Aix do end it "service is a group" do - expect(@provider).to receive(:shell_out!).with("lssrc -g chef").and_return(@status) + expect(@provider).to receive(:shell_out).with("lssrc -g chef").and_return(@status) @provider.load_current_resource expect(@provider.instance_eval("@is_resource_group")).to be_truthy end @@ -119,7 +119,7 @@ describe Chef::Provider::Service::Aix do end it "service is a subsystem" do - expect(@provider).to receive(:shell_out!).with("lssrc -g chef").and_return(@group_status) + expect(@provider).to receive(:shell_out).with("lssrc -g chef").and_return(@group_status) expect(@provider).to receive(:shell_out!).with("lssrc -s chef").and_return(@service_status) @provider.load_current_resource expect(@provider.instance_eval("@is_resource_group")).to be_falsey |