Skip to content
Permalink
Browse files

Conditionally set start, stop, restart and status commands based on p…

…latform_family and platform_version.
  • Loading branch information...
Azrael808 committed Jun 19, 2015
1 parent 0ade878 commit 7ceeffb96046e123aa32322960084914b48e4bfd
Showing with 21 additions and 6 deletions.
  1. +21 −6 providers/instance.rb
@@ -122,8 +122,13 @@ def whyrun_supported?
service "dirsrv-#{new_resource.instance}" do
service_name "dirsrv"
supports :status => true
start_command "service dirsrv start #{new_resource.instance}"
status_command "service dirsrv status #{new_resource.instance}"
if node[:platform_family] == 'rhel' && node[:platform_version].to_i >= 7
start_command "systemctl start dirsrv@#{new_resource.instance}"
status_command "systemctl status dirsrv@#{new_resource.instance}"
else
start_command "service dirsrv start #{new_resource.instance}"
status_command "service dirsrv status #{new_resource.instance}"
end
action :start
end

@@ -145,8 +150,13 @@ def whyrun_supported?
service "dirsrv-#{new_resource.instance}" do
service_name "dirsrv"
supports :status => true
stop_command "service dirsrv stop #{new_resource.instance}"
status_command "service dirsrv status #{new_resource.instance}"
if node[:platform_family] == 'rhel' && node[:platform_version].to_i >= 7
start_command "systemctl stop dirsrv@#{new_resource.instance}"
status_command "systemctl status dirsrv@#{new_resource.instance}"
else
stop_command "service dirsrv stop #{new_resource.instance}"
status_command "service dirsrv status #{new_resource.instance}"
end
action :stop
end

@@ -164,8 +174,13 @@ def whyrun_supported?
service "dirsrv-#{new_resource.instance}" do
service_name "dirsrv"
supports :status => true, :restart => true
restart_command "service dirsrv restart #{new_resource.instance}"
status_command "service dirsrv status #{new_resource.instance}"
if node[:platform_family] == 'rhel' && node[:platform_version].to_i >= 7
start_command "systemctl restart dirsrv@#{new_resource.instance}"
status_command "systemctl status dirsrv@#{new_resource.instance}"
else
restart_command "service dirsrv restart #{new_resource.instance}"
status_command "service dirsrv status #{new_resource.instance}"
end
action :restart
end

0 comments on commit 7ceeffb

Please sign in to comment.
You can’t perform that action at this time.