Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for sysvinit #344

Merged
merged 1 commit into from
Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 8 additions & 44 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,13 @@
class jira::params {
Exec { path => ['/bin/', '/sbin/', '/usr/bin/', '/usr/sbin/'] }

case $facts['os']['family'] {
/RedHat/: {
if $facts['os']['name'] == 'Amazon' and $facts['os']['release']['major'] =='2018' {
$json_packages = ['rubygem-json']
$service_file_location = '/etc/init.d/jira'
$service_file_template = 'jira/jira.initscript.erb'
$service_file_mode = '0755'
$service_lockfile = '/var/lock/subsys/jira'
$service_provider = undef
} elsif versioncmp($facts['os']['release']['major'], '7') >= 0 {
$json_packages = ['rubygem-json']
$service_file_location = '/usr/lib/systemd/system/jira.service'
$service_file_template = 'jira/jira.service.erb'
$service_file_mode = '0644'
$service_lockfile = '/var/lock/subsys/jira'
$service_provider = 'systemd'
} elsif versioncmp($facts['os']['release']['major'], '6') >= 0 {
$json_packages = ['rubygem-json', 'ruby-json']
$service_file_location = '/etc/init.d/jira'
$service_file_template = 'jira/jira.initscript.erb'
$service_file_mode = '0755'
$service_lockfile = '/var/lock/subsys/jira'
$service_provider = undef
} else {
fail("\"${module_name}\" provides no service parameters
for \"${facts['os']['family']}\" - \"${$facts['os']['release']['major']}\"")
}
}
/Debian/: {
$json_packages = ['ruby-json']
$service_file_location = '/lib/systemd/system/jira.service'
$service_file_template = 'jira/jira.service.erb'
$service_file_mode = '0644'
$service_lockfile = '/var/lock/subsys/jira'
$service_provider = 'systemd'
}
default: {
$json_packages = ['rubygem-json', 'ruby-json']
$service_file_location = '/etc/init.d/jira'
$service_file_template = 'jira/jira.initscript.erb'
$service_file_mode = '0755'
$service_lockfile = '/var/lock/subsys/jira'
$service_provider = undef
}
$service_file_location = '/usr/lib/systemd/system/jira.service'
$service_file_template = 'jira/jira.service.erb'
$service_file_mode = '0644'

$json_packages = $facts['os']['family'] ? {
'RedHat' => ['rubygem-json'],
'Debian' => ['ruby-json'],
default => [],
}
}
15 changes: 5 additions & 10 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
$service_file_location = $jira::params::service_file_location,
$service_file_template = $jira::params::service_file_template,
$service_file_mode = $jira::params::service_file_mode,
$service_lockfile = $jira::params::service_lockfile,
$service_provider = $jira::params::service_provider,

) inherits jira::params {
file { $service_file_location:
Expand All @@ -33,13 +31,11 @@
}

if $service_manage {
if $service_provider == 'systemd' {
exec { 'refresh_systemd':
command => 'systemctl daemon-reload',
refreshonly => true,
subscribe => File[$service_file_location],
before => Service['jira'],
}
exec { 'refresh_systemd':
command => 'systemctl daemon-reload',
refreshonly => true,
subscribe => File[$service_file_location],
before => Service['jira'],
}

service { 'jira':
Expand All @@ -48,7 +44,6 @@
require => File[$service_file_location],
notify => $service_notify,
subscribe => $service_subscribe,
provider => $service_provider,
}
}
}
4 changes: 0 additions & 4 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,24 @@
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"6",
"7"
]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"6",
"7"
]
},
{
"operatingsystem": "OracleLinux",
"operatingsystemrelease": [
"6",
"7"
]
},
{
"operatingsystem": "Scientific",
"operatingsystemrelease": [
"6",
"7"
]
},
Expand Down
29 changes: 4 additions & 25 deletions spec/classes/jira_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,14 @@
'package { "jdk": }'
end

case facts[:os]['family']
when 'RedHat'
service_file_location = if facts['service_provider'] == 'systemd'
'/usr/lib/systemd/system/jira.service'
else
'/etc/init.d/jira'
end
when 'Debian'
service_file_location = '/lib/systemd/system/jira.service'
end

context 'with defaults for all parameters' do
it { is_expected.to compile.with_all_deps }

case facts['service_provider']
when 'systemd'
it do
is_expected.to contain_file(service_file_location).
with_content(%r{Atlassian Systemd Jira Service})
end
it { is_expected.to contain_exec('refresh_systemd') }
when 'redhat'
it do
is_expected.to contain_file(service_file_location).
with_content(%r{Short-Description: Start up JIRA}).
with_content(%r{lockfile=/var/lock/subsys/jira})
end
it do
is_expected.to contain_file('/lib/systemd/system/jira.service').
with_content(%r{Atlassian Systemd Jira Service})
end

it { is_expected.to contain_exec('refresh_systemd') }
it { is_expected.to contain_service('jira') }
end

Expand Down
96 changes: 0 additions & 96 deletions templates/jira.initscript.erb

This file was deleted.