Skip to content

Commit

Permalink
Merge pull request #584 from puppetlabs/CAT-1426-removal-of-red-hat-s…
Browse files Browse the repository at this point in the history
…cientific-oracle-linux-6-for-haproxy-module

(CAT-1426)-Removal of redhat/scientific/oraclelinux 6 for haproxy module
  • Loading branch information
Ramesh7 authored Sep 20, 2023
2 parents 0462b3b + 10c144e commit 2679e8f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 65 deletions.
80 changes: 34 additions & 46 deletions manifests/instance_service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -79,57 +79,45 @@
if ($title == 'haproxy') and ($haproxy_package == 'haproxy') {
} else {
$initfile = "/etc/init.d/haproxy-${title}"
if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '6' {
# init.d:
file { $initfile:
ensure => file,
mode => '0744',
owner => 'root',
group => 'root',
source => $haproxy_init_source,
}
File[$haproxy_link] -> File[$initfile]
# systemd:
if $haproxy_package == 'haproxy' {
$wrapper = '/usr/sbin/haproxy-systemd-wrapper'
} else {
# systemd:
if $haproxy_package == 'haproxy' {
$wrapper = '/usr/sbin/haproxy-systemd-wrapper'
} else {
$wrapper = "/opt/${haproxy_package}/sbin/haproxy-systemd-wrapper"
}
$wrapper = "/opt/${haproxy_package}/sbin/haproxy-systemd-wrapper"
}

if $facts['os']['family'] == 'RedHat' {
$unitfile = "/usr/lib/systemd/system/haproxy-${title}.service"
} else {
$unitfile = "/lib/systemd/system/haproxy-${title}.service"
}
if $facts['os']['family'] == 'RedHat' {
$unitfile = "/usr/lib/systemd/system/haproxy-${title}.service"
} else {
$unitfile = "/lib/systemd/system/haproxy-${title}.service"
}

$parameters = {
'title' => $title,
'wrapper' => $wrapper,
}
file { $unitfile:
ensure => file,
mode => '0644',
owner => 'root',
group => 'root',
content => epp($haproxy_unit_template, $parameters),
notify => Exec['systemctl daemon-reload'],
}
if (!defined(Exec['systemctl daemon-reload'])) {
exec { 'systemctl daemon-reload':
command => 'systemctl daemon-reload',
path => '/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin',
refreshonly => true,
before => Service["haproxy-${title}"],
}
}
File[$haproxy_link] -> File[$unitfile]
# Clean up in case the old init.d-style file is still around.
file { $initfile:
ensure => absent,
before => Service["haproxy-${title}"],
$parameters = {
'title' => $title,
'wrapper' => $wrapper,
}
file { $unitfile:
ensure => file,
mode => '0644',
owner => 'root',
group => 'root',
content => epp($haproxy_unit_template, $parameters),
notify => Exec['systemctl daemon-reload'],
}
if (!defined(Exec['systemctl daemon-reload'])) {
exec { 'systemctl daemon-reload':
command => 'systemctl daemon-reload',
path => '/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin',
refreshonly => true,
before => Service["haproxy-${title}"],
}
}
File[$haproxy_link] -> File[$unitfile]
# Clean up in case the old init.d-style file is still around.
file { $initfile:
ensure => absent,
before => Service["haproxy-${title}"],
}
}

Package[$haproxy_package] -> File[$bindir] -> File[$haproxy_link]
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/userlist_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'spec_helper_acceptance'

describe 'userlist define', unless: (os[:family] == 'redhat' && os[:release][0] == '5') do
describe 'userlist define' do
pp_one = <<-PUPPETCODE
class { 'haproxy': }
haproxy::userlist { 'users_groups':
Expand Down
19 changes: 1 addition & 18 deletions spec/spec_helper_acceptance_local.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,8 @@ def retry_on_error_matching(max_retry_count = MAX_RETRY_COUNT, retry_wait_interv

if os[:family] == 'redhat' && os[:release].to_i != 8
epel_owner = 'puppet'
epel_owner = 'stahnma' if os[:release].to_i == 6
LitmusHelper.instance.run_shell("puppet module install #{epel_owner}/epel")
if os[:release][0].match?(%r{5|6})
pp = <<-PP
class { 'epel':
epel_baseurl => "http://osmirror.delivery.puppetlabs.net/epel${::operatingsystemmajrelease}-\\$basearch/RPMS.all",
epel_mirrorlist => "http://osmirror.delivery.puppetlabs.net/epel${::operatingsystemmajrelease}-\\$basearch/RPMS.all",
}
PP
LitmusHelper.instance.apply_manifest(pp)
else
LitmusHelper.instance.run_shell("puppet apply -e 'include epel'")
end
end
if os[:family] == 'redhat' && os[:release].to_i == 6
LitmusHelper.instance.run_shell('yum clean all')
LitmusHelper.instance.run_shell('yum --disablerepo="epel" update nss -y')
LitmusHelper.instance.run_shell("puppet apply -e 'include epel'")
end
pp = <<-PP
package { 'curl': ensure => present, }
Expand Down

0 comments on commit 2679e8f

Please sign in to comment.