Skip to content

Commit 4827b67

Browse files
committed
cleanup whitespace and unneeded ternary operators
1 parent 18d5f1c commit 4827b67

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

chef/lib/chef/provider/service/windows.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,25 @@
1919
require 'chef/provider/service/init'
2020

2121
class Chef::Provider::Service::Windows < Chef::Provider::Service::Init
22-
22+
2323
def initialize(node, new_resource, collection=nil, definitions=nil, cookbook_loader=nil)
2424
super(node, new_resource, collection, definitions, cookbook_loader)
2525
@init_command = "sc"
2626
end
27-
27+
2828
def load_current_resource
2929
@current_resource = Chef::Resource::Service.new(@new_resource.name)
3030
@current_resource.service_name(@new_resource.service_name)
3131
status = IO.popen("#{@init_command} query #{@new_resource.service_name}").entries
3232
raise Chef::Exceptions::Exec, "Service #{@new_resource.service_name} does not exist.\n#{status.join}\n" if status[0].include?("FAILED 1060")
33-
33+
3434
begin
3535
started = status[3].include?("4")
3636
@current_resource.running started
37-
37+
3838
start_type = IO.popen("#{@init_command} qc #{@new_resource.service_name}").entries[4]
3939
@current_resource.enabled(start_type.include?('2') || start_type.include?('3') ? true : false)
40-
40+
4141
Chef::Log.debug "#{@new_resource}: running: #{@current_resource.running}"
4242
rescue StandardError
4343
raise Chef::Exceptions::Exec
@@ -48,7 +48,7 @@ def load_current_resource
4848
end
4949
@current_resource
5050
end
51-
51+
5252
def start_service
5353
begin
5454
result = if @new_resource.start_command
@@ -74,11 +74,11 @@ def stop_service
7474
IO.popen("#{@init_command} stop #{@new_resource.service_name}").readlines
7575
end
7676
Chef::Log.debug result.join
77-
result[3].include?('1') ? true : false
77+
result[3].include?('1')
7878
rescue
7979
Chef::Log.debug "Failed to stop service #{@new_resource.service_name}"
8080
false
81-
end
81+
end
8282
end
8383

8484
def restart_service
@@ -93,7 +93,7 @@ def restart_service
9393
result = IO.popen("#{@init_command} start #{@new_resource.service_name}").readlines
9494
Chef::Log.debug result.join
9595
end
96-
result[3].include?('4') || result.include?('2') ? true : false
96+
result[3].include?('4') || result.include?('2')
9797
rescue
9898
Chef::Log.debug "Failed to restart service #{@new_resource.service_name}"
9999
false
@@ -103,7 +103,7 @@ def restart_service
103103
def enable_service()
104104
begin
105105
Chef::Log.debug result = IO.popen("#{@init_command} config #{@new_resource.service_name} start= #{determine_startup_type}").readlines.join
106-
result.include?('SUCCESS') ? true : false
106+
result.include?('SUCCESS')
107107
rescue
108108
Chef::Log.debug "Failed to enable service #{@new_resource.service_name}"
109109
false
@@ -113,13 +113,13 @@ def enable_service()
113113
def disable_service()
114114
begin
115115
Chef::Log.debug result = IO.popen("#{@init_command} config #{@new_resource.service_name} start= disabled").readlines.join
116-
result.include?('SUCCESS') ? true : false
116+
result.include?('SUCCESS')
117117
rescue
118118
Chef::Log.debug "Failed to disable service #{@new_resource.service_name}"
119119
false
120120
end
121121
end
122-
122+
123123
private
124124

125125
def determine_startup_type

chef/lib/chef/providers.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
require 'chef/provider/service/redhat'
6363
require 'chef/provider/service/simple'
6464
require 'chef/provider/service/upstart'
65+
require 'chef/provider/service/windows'
6566

6667
require 'chef/provider/user/dscl'
6768
require 'chef/provider/user/pw'

0 commit comments

Comments
 (0)