Skip to content

Commit 938d86e

Browse files
committed
Update helper methods for servie commands
Signed-off-by: Balasankar "Balu" C <[email protected]>
1 parent 355105b commit 938d86e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

libraries/helpers.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def runit_send_signal(signal, friendly_name = nil)
7171
end
7272

7373
def running?
74-
cmd = safe_sv_shellout("#{sv_args}status #{service_dir_name}", returns: [0, 100])
74+
cmd = safe_sv_shellout("#{sv_args}#{new_resource.status_command} #{service_dir_name}", returns: [0, 100])
7575
!cmd.error? && cmd.stdout =~ /^run:/
7676
end
7777

@@ -153,15 +153,15 @@ def disable_service
153153
end
154154

155155
def start_service
156-
safe_sv_shellout!("#{sv_args}start #{service_dir_name}")
156+
safe_sv_shellout!("#{sv_args}#{new_resource.start_command} #{service_dir_name}")
157157
end
158158

159159
def stop_service
160-
safe_sv_shellout!("#{sv_args}stop #{service_dir_name}")
160+
safe_sv_shellout!("#{sv_args}#{new_resource.stop_command} #{service_dir_name}")
161161
end
162162

163163
def restart_service
164-
safe_sv_shellout!("#{sv_args}restart #{service_dir_name}")
164+
safe_sv_shellout!("#{sv_args}#{new_resource.restart_command} #{service_dir_name}")
165165
end
166166

167167
def restart_log_service

libraries/resource_runit_service.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ class RunitService < Chef::Resource::Service
5757
property :check_script_template_name, String, default: lazy { service_name }
5858
property :finish_script_template_name, String, default: lazy { service_name }
5959
property :control_template_names, Hash, default: lazy { set_control_template_names }
60-
property :status_command, String, default: lazy { "#{sv_bin} status #{service_name}" }
6160
property :start_command, String, default: 'start'
6261
property :stop_command, String, default: 'stop'
6362
property :restart_command, String, default: 'restart'
63+
property :status_command, String, default: 'status'
6464
property :sv_templates, [true, false], default: true
6565
property :sv_timeout, Integer
66-
property :sv_verbose, [TrueClass, FalseClass], default: false
66+
property :sv_verbose, [true, false], default: false
6767
property :log_dir, String, default: lazy { ::File.join('/var/log/', service_name) }
6868
property :log_flags, String, default: '-tt'
6969
property :log_size, Integer
@@ -103,10 +103,10 @@ def after_created
103103
find_resource(:service, new_resource.name) do # creates if it does not exist
104104
provider Chef::Provider::Service::Simple
105105
supports new_resource.supports
106-
status_command new_resource.status_command
107106
start_command "#{new_resource.sv_bin} #{new_resource.start_command} #{service_dir_name}"
108107
stop_command "#{new_resource.sv_bin} #{new_resource.stop_command} #{service_dir_name}"
109108
restart_command "#{new_resource.sv_bin} #{new_resource.restart_command} #{service_dir_name}"
109+
status_command "#{new_resource.sv_bin} #{new_resource.status_command} #{service_dir_name}"
110110
action :nothing
111111
end
112112
end

0 commit comments

Comments
 (0)