Skip to content

Commit

Permalink
Merge pull request RiotGamesCookbooks#3 from Azrael808/centos7_support
Browse files Browse the repository at this point in the history
Adding CentOS 7 Support
  • Loading branch information
awillis committed Feb 5, 2016
2 parents 13fa77f + ad4c418 commit 67f2ed8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
28 changes: 22 additions & 6 deletions providers/instance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,14 @@ 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}"
restart_command "systemctl restart 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

Expand All @@ -145,8 +151,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
stop_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

Expand All @@ -164,8 +175,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
restart_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

Expand Down
4 changes: 2 additions & 2 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
if node[:dirsrv][:use_yum_epel] and platform_family?("rhel")
yum_repository 'epel' do
description 'Extra Packages for Enterprise Linux'
mirrorlist 'http://mirrors.fedoraproject.org/mirrorlist?repo=epel-6&arch=$basearch'
gpgkey 'http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6'
mirrorlist "http://mirrors.fedoraproject.org/mirrorlist?repo=epel-#{node[:platform_version].split(".").first}&arch=$basearch"
gpgkey "http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{node[:platform_version].split(".").first}"
action :create
end
end
Expand Down

0 comments on commit 67f2ed8

Please sign in to comment.