Skip to content

Commit 8b5a7c5

Browse files
committed
Make runit service's control commands configurable
Signed-off-by: Balasankar "Balu" C <[email protected]>
1 parent c1782b9 commit 8b5a7c5

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

libraries/resource_runit_service.rb

+8-5
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ class RunitService < Chef::Resource::Service
5858
property :check_script_template_name, String, default: lazy { service_name }
5959
property :finish_script_template_name, String, default: lazy { service_name }
6060
property :control_template_names, Hash, default: lazy { set_control_template_names }
61-
property :status_command, String, default: lazy { "#{sv_bin} status #{service_dir}" }
61+
property :status_command, String, default: 'status'
62+
property :start_command, String, default: 'start'
63+
property :stop_command, String, default: 'stop'
64+
property :restart_command, String, default: 'restart'
6265
property :sv_templates, [TrueClass, FalseClass], default: true
6366
property :sv_timeout, Integer
6467
property :sv_verbose, [TrueClass, FalseClass], default: false
@@ -97,10 +100,10 @@ def after_created
97100
find_resource(:service, new_resource.name) do # creates if it does not exist
98101
provider Chef::Provider::Service::Simple
99102
supports new_resource.supports
100-
start_command "#{new_resource.sv_bin} start #{service_dir_name}"
101-
stop_command "#{new_resource.sv_bin} stop #{service_dir_name}"
102-
restart_command "#{new_resource.sv_bin} restart #{service_dir_name}"
103-
status_command "#{new_resource.sv_bin} status #{service_dir_name}"
103+
start_command "#{new_resource.sv_bin} #{new_resource.start_command} #{service_dir_name}"
104+
stop_command "#{new_resource.sv_bin} #{new_resource.stop_command} #{service_dir_name}"
105+
restart_command "#{new_resource.sv_bin} #{new_resource.restart_command} #{service_dir_name}"
106+
status_command "#{new_resource.sv_bin} #{new_resource.status_command} #{service_dir_name}"
104107
action :nothing
105108
end
106109
end

0 commit comments

Comments
 (0)