diff options
author | Claire McQuin <claire@getchef.com> | 2014-06-11 12:44:18 -0700 |
---|---|---|
committer | Claire McQuin <claire@getchef.com> | 2014-06-18 15:25:44 -0700 |
commit | 598b3b28769f5019546fd8eaa33524d36e78ceb1 (patch) | |
tree | ced07a3436ce9ee2ff65f59c1f3845590fcf5f24 | |
parent | d950ec4bea3333e8739630c37156d6b9d06eccda (diff) | |
download | chef-598b3b28769f5019546fd8eaa33524d36e78ceb1.tar.gz |
fix indenting
-rw-r--r-- | lib/chef/provider/service/windows.rb | 10 | ||||
-rw-r--r-- | lib/chef/resource/service.rb | 27 | ||||
-rw-r--r-- | spec/unit/provider/service/windows_spec.rb | 11 |
3 files changed, 27 insertions, 21 deletions
diff --git a/lib/chef/provider/service/windows.rb b/lib/chef/provider/service/windows.rb index ba2d5d76ed..0e26325d30 100644 --- a/lib/chef/provider/service/windows.rb +++ b/lib/chef/provider/service/windows.rb @@ -82,7 +82,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service raise Chef::Exceptions::Service, "Service #{@new_resource} can't be started from state [#{state}]" end else - Chef::Log.debug "#{@new_resource} does not exist - nothing to do" + Chef::Log.debug "#{@new_resource} does not exist - nothing to do" end end @@ -178,12 +178,12 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service end def command_timeout - timeout = @new_resource.timeout if @new_resource.timeout - timeout ||= TIMEOUT - Chef::Log.debug "service command timeout [#{timeout}]" + timeout = @new_resource.timeout if @new_resource.timeout + timeout ||= TIMEOUT + Chef::Log.debug "service command timeout [#{timeout}]" Timeout.timeout(timeout) do - yield + yield end end end diff --git a/lib/chef/resource/service.rb b/lib/chef/resource/service.rb index a7f1aa3470..36df7c859a 100644 --- a/lib/chef/resource/service.rb +++ b/lib/chef/resource/service.rb @@ -42,7 +42,7 @@ class Chef @reload_command = nil @init_command = nil @priority = nil - @timeout = nil + @timeout = nil @action = "nothing" @supports = { :restart => false, :reload => false, :status => false } @allowed_actions.push(:enable, :disable, :start, :stop, :restart, :reload) @@ -151,23 +151,28 @@ class Chef # similar for other runlevels # def priority(arg=nil) - set_or_return(:priority, - arg, - :kind_of => [ Integer, String, Hash ]) + set_or_return( + :priority, + arg, + :kind_of => [ Integer, String, Hash ] + ) end - # timeout only applies to the windows service manager - def timeout(arg=nil) - set_or_return(:timeout, - arg, - :kind_of => Integer ) + # timeout only applies to the windows service manager + def timeout(arg=nil) + set_or_return( + :timeout, + arg, + :kind_of => Integer + ) end - + def parameters(arg=nil) set_or_return( :parameters, arg, - :kind_of => [ Hash ] ) + :kind_of => [ Hash ] + ) end def supports(args={}) diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb index d60c6f03ff..33d3cde8fd 100644 --- a/spec/unit/provider/service/windows_spec.rb +++ b/spec/unit/provider/service/windows_spec.rb @@ -161,7 +161,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do @provider.stop_service @new_resource.updated_by_last_action?.should be_false end - + it "should raise an error if the service is paused" do Win32::Service.stub(:status).with(@new_resource.service_name).and_return( double("StatusStruct", :current_state => "paused")) @@ -194,13 +194,14 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do it "should pass custom timeout to the stop command if provided" do Win32::Service.stub!(:status).with(@new_resource.service_name).and_return( mock("StatusStruct", :current_state => "running")) - @new_resource.timeout 1 + @new_resource.timeout 1 Win32::Service.should_receive(:stop).with(@new_resource.service_name) - Timeout.timeout(2) do - expect { @provider.stop_service }.to raise_error(Timeout::Error) - end + Timeout.timeout(2) do + expect { @provider.stop_service }.to raise_error(Timeout::Error) + end @new_resource.updated_by_last_action?.should be_false end + end describe Chef::Provider::Service::Windows, "restart_service" do |