Skip to content

Commit

Permalink
Make runit service's control commands configurable
Browse files Browse the repository at this point in the history
Signed-off-by: Balasankar "Balu" C <balasankar@gitlab.com>
  • Loading branch information
balasankarc committed Feb 25, 2019
1 parent c1782b9 commit 8b5a7c5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions libraries/resource_runit_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ class RunitService < Chef::Resource::Service
property :check_script_template_name, String, default: lazy { service_name }
property :finish_script_template_name, String, default: lazy { service_name }
property :control_template_names, Hash, default: lazy { set_control_template_names }
property :status_command, String, default: lazy { "#{sv_bin} status #{service_dir}" }
property :status_command, String, default: 'status'
property :start_command, String, default: 'start'
property :stop_command, String, default: 'stop'
property :restart_command, String, default: 'restart'
property :sv_templates, [TrueClass, FalseClass], default: true
property :sv_timeout, Integer
property :sv_verbose, [TrueClass, FalseClass], default: false
Expand Down Expand Up @@ -97,10 +100,10 @@ def after_created
find_resource(:service, new_resource.name) do # creates if it does not exist
provider Chef::Provider::Service::Simple
supports new_resource.supports
start_command "#{new_resource.sv_bin} start #{service_dir_name}"
stop_command "#{new_resource.sv_bin} stop #{service_dir_name}"
restart_command "#{new_resource.sv_bin} restart #{service_dir_name}"
status_command "#{new_resource.sv_bin} status #{service_dir_name}"
start_command "#{new_resource.sv_bin} #{new_resource.start_command} #{service_dir_name}"
stop_command "#{new_resource.sv_bin} #{new_resource.stop_command} #{service_dir_name}"
restart_command "#{new_resource.sv_bin} #{new_resource.restart_command} #{service_dir_name}"
status_command "#{new_resource.sv_bin} #{new_resource.status_command} #{service_dir_name}"
action :nothing
end
end
Expand Down

0 comments on commit 8b5a7c5

Please sign in to comment.