Skip to content

Commit a44ac70

Browse files
authored
Merge pull request #229 from KoenDierckx/master
Use systemd on Ubuntu 16.04
2 parents 5e47233 + 666ca4f commit a44ac70

9 files changed

Lines changed: 95 additions & 61 deletions

File tree

examples/jira_postgres_nginx_install.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
javahome => '/opt/java/latest',
1919
proxy => {
2020
scheme => 'http',
21-
proxyName => $::fqdn,
21+
proxyName => $facts['fqdn'],
2222
proxyPort => '80',
2323
},
2424
}
@@ -32,7 +32,7 @@
3232

3333
nginx::resource::vhost { 'jira_vhost':
3434
ensure => present,
35-
server_name => [ $::ipaddress, $::fqdn, $hostname ],
35+
server_name => [ $facts['ipaddress'], $facts['fqdn'], $facts['hostname'] ],
3636
listen_port => '80',
3737
proxy => 'http://jira',
3838
proxy_read_timeout => '300',

examples/jira_postgres_nginx_ssl_install.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
javahome => '/opt/java/latest',
1919
proxy => {
2020
scheme => 'https',
21-
proxyName => $::fqdn,
21+
proxyName => $facts['fqdn'],
2222
proxyPort => '443',
2323
},
2424
}
@@ -32,7 +32,7 @@
3232

3333
nginx::resource::vhost { 'jira_vhost':
3434
ensure => present,
35-
server_name => [ $::ipaddress, $::fqdn, $hostname ],
35+
server_name => [ $facts['ipaddress'], $facts['fqdn'], $facts['hostname'] ],
3636
proxy => 'http://jira',
3737
proxy_read_timeout => '300',
3838
rewrite_to_https => true,

manifests/facts.pp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#
1515
# class { 'jira::facts': }
1616
#
17-
class jira::facts(
17+
class jira::facts (
1818
$ensure = 'present',
1919
$port = $jira::tomcat_port,
2020
$contextpath = $jira::contextpath,
@@ -29,26 +29,26 @@
2929

3030
# Puppet Enterprise supplies its own ruby version if your using it.
3131
# A modern ruby version is required to run the executable fact
32-
if $::puppetversion =~ /Puppet Enterprise/ {
32+
if $facts['puppetversion'] =~ /Puppet Enterprise/ {
3333
$ruby_bin = '/opt/puppet/bin/ruby'
34-
$dir = 'puppetlabs/'
34+
$dir = 'puppetlabs/'
3535
} else {
3636
$ruby_bin = '/usr/bin/env ruby'
37-
$dir = ''
37+
$dir = ''
3838
}
3939

40-
if ! defined(File["/etc/${dir}facter"]) {
40+
if !defined(File["/etc/${dir}facter"]) {
4141
file { "/etc/${dir}facter":
42-
ensure => directory,
42+
ensure => directory,
4343
}
4444
}
45-
if ! defined(File["/etc/${dir}facter/facts.d"]) {
45+
if !defined(File["/etc/${dir}facter/facts.d"]) {
4646
file { "/etc/${dir}facter/facts.d":
47-
ensure => directory,
47+
ensure => directory,
4848
}
4949
}
5050

51-
if $::osfamily == 'RedHat' and $::puppetversion !~ /Puppet Enterprise/ {
51+
if $facts['osfamily'] == 'RedHat' and $facts['puppetversion'] !~ /Puppet Enterprise/ {
5252
package { $json_packages:
5353
ensure => present,
5454
}

manifests/params.pp

Lines changed: 50 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,67 @@
44
#
55
class jira::params {
66

7-
Exec { path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ] }
7+
Exec { path => [ '/bin/', '/sbin/', '/usr/bin/', '/usr/sbin/' ] }
88

9-
case $::osfamily {
9+
case $facts['osfamily'] {
1010
/RedHat/: {
11-
if versioncmp($::operatingsystemmajrelease, '7') >= 0 {
12-
$json_packages = 'rubygem-json'
13-
$service_file_location = '/usr/lib/systemd/system/jira.service'
14-
$service_file_template = 'jira/jira.service.erb'
15-
$service_lockfile = '/var/lock/subsys/jira'
16-
$service_provider = 'systemd'
17-
} elsif versioncmp($::operatingsystemmajrelease, '6') >= 0 or $::operatingsystem == 'Amazon'{
18-
$json_packages = [ 'rubygem-json', 'ruby-json' ]
19-
$service_file_location = '/etc/init.d/jira'
20-
$service_file_template = 'jira/jira.initscript.erb'
21-
$service_lockfile = '/var/lock/subsys/jira'
22-
$service_provider = undef
11+
if versioncmp($facts['operatingsystemmajrelease'], '7') >= 0 {
12+
$json_packages = 'rubygem-json'
13+
$service_file_location = '/usr/lib/systemd/system/jira.service'
14+
$service_file_template = 'jira/jira.service.erb'
15+
$service_lockfile = '/var/lock/subsys/jira'
16+
$service_provider = 'systemd'
17+
} elsif versioncmp($facts['operatingsystemmajrelease'], '6') >= 0 or $facts['operatingsystem'] == 'Amazon' {
18+
$json_packages = [ 'rubygem-json', 'ruby-json' ]
19+
$service_file_location = '/etc/init.d/jira'
20+
$service_file_template = 'jira/jira.initscript.erb'
21+
$service_lockfile = '/var/lock/subsys/jira'
22+
$service_provider = undef
2323
} else {
2424
fail("\"${module_name}\" provides no service parameters
25-
for \"${::osfamily}\" - \"${::operatingsystemmajrelease}\"")
25+
for \"${::osfamily}\" - \"${$facts['operatingsystemmajrelease']}\"")
2626
}
27-
} /Debian/: {
27+
}
28+
/Debian/: {
2829
case $::operatingsystem {
2930
'Ubuntu': {
30-
$json_packages = [ 'rubygem-json', 'ruby-json' ]
31-
$service_file_location = '/etc/init.d/jira'
32-
$service_file_template = 'jira/jira.initscript.erb'
33-
$service_lockfile = '/var/lock/jira'
34-
$service_provider = 'debian'
35-
} default: {
36-
if versioncmp($::operatingsystemmajrelease, '8') >= 0 {
37-
$json_packages = 'ruby-json'
38-
$service_file_location = '/lib/systemd/system/jira.service'
39-
$service_file_template = 'jira/jira.service.erb'
40-
$service_lockfile = '/var/lock/subsys/jira'
41-
$service_provider = 'systemd'
31+
if versioncmp($facts['operatingsystemmajrelease'], '15.04') >= 0 {
32+
$json_packages = 'ruby-json'
33+
$service_file_location = '/lib/systemd/system/jira.service'
34+
$service_file_template = 'jira/jira.service.erb'
35+
$service_lockfile = '/var/lock/subsys/jira'
36+
$service_provider = 'systemd'
4237
} else {
43-
$json_packages = [ 'rubygem-json', 'ruby-json' ]
44-
$service_file_location = '/etc/init.d/jira'
45-
$service_file_template = 'jira/jira.initscript.erb'
46-
$service_lockfile = '/var/lock/jira'
47-
$service_provider = 'debian'
38+
$json_packages = [ 'rubygem-json', 'ruby-json' ]
39+
$service_file_location = '/etc/init.d/jira'
40+
$service_file_template = 'jira/jira.initscript.erb'
41+
$service_lockfile = '/var/lock/jira'
42+
$service_provider = 'debian'
43+
}
44+
}
45+
default: {
46+
if versioncmp($facts['operatingsystemmajrelease'], '8') >= 0 {
47+
$json_packages = 'ruby-json'
48+
$service_file_location = '/lib/systemd/system/jira.service'
49+
$service_file_template = 'jira/jira.service.erb'
50+
$service_lockfile = '/var/lock/subsys/jira'
51+
$service_provider = 'systemd'
52+
} else {
53+
$json_packages = [ 'rubygem-json', 'ruby-json' ]
54+
$service_file_location = '/etc/init.d/jira'
55+
$service_file_template = 'jira/jira.initscript.erb'
56+
$service_lockfile = '/var/lock/jira'
57+
$service_provider = 'debian'
4858
}
4959
}
5060
}
51-
} default: {
52-
$json_packages = [ 'rubygem-json', 'ruby-json' ]
53-
$service_file_location = '/etc/init.d/jira'
54-
$service_file_template = 'jira/jira.initscript.erb'
55-
$service_lockfile = '/var/lock/subsys/jira'
56-
$service_provider = undef
61+
}
62+
default: {
63+
$json_packages = [ 'rubygem-json', 'ruby-json' ]
64+
$service_file_location = '/etc/init.d/jira'
65+
$service_file_template = 'jira/jira.initscript.erb'
66+
$service_lockfile = '/var/lock/subsys/jira'
67+
$service_provider = undef
5768
}
5869
}
5970
}

metadata.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@
6464
"operatingsystem": "Ubuntu",
6565
"operatingsystemrelease": [
6666
"12.04",
67-
"14.04"
67+
"14.04",
68+
"16.04"
6869
]
6970
},
7071
{

spec/acceptance/default_parameters_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
describe 'jira postgresql', unless: UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
44
it 'installs with defaults' do
55
pp = <<-EOS
6-
if versioncmp($::puppetversion,'3.6.1') >= 0 {
6+
if versioncmp($facts['puppetversion'],'3.6.1') >= 0 {
77
$allow_virtual_packages = hiera('allow_virtual_packages',false)
88
Package {
99
allow_virtual => $allow_virtual_packages,

spec/acceptance/mysql_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
describe 'jira mysql', unless: UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
44
it 'installs with mysql database' do
55
pp = <<-EOS
6-
if versioncmp($::puppetversion,'3.6.1') >= 0 {
6+
if versioncmp($facts['puppetversion'],'3.6.1') >= 0 {
77
$allow_virtual_packages = hiera('allow_virtual_packages',false)
88
Package {
99
allow_virtual => $allow_virtual_packages,

spec/classes/jira_service_spec.rb

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@
3333
end
3434
if os == 'Debian'
3535
context 'lockfile on Debian' do
36-
let(:facts) do
37-
{ osfamily: 'Debian' }
38-
end
39-
4036
it { is_expected.to compile.with_all_deps }
4137
it do
4238
is_expected.to contain_file('/etc/init.d/jira').
@@ -47,9 +43,35 @@
4743
if os =~ %r{ubuntu}
4844
context 'default params' do
4945
it { is_expected.to compile.with_all_deps }
46+
end
47+
end
48+
if os =~ %r{ubuntu-12}
49+
context 'default params' do
50+
let(:facts) do
51+
facts.merge(operatingsystem: 'Ubuntu', operatingsystemmajrelease: '12.04')
52+
end
53+
54+
it { is_expected.not_to contain_file('/lib/systemd/system/jira.service') }
55+
end
56+
end
57+
if os =~ %r{ubuntu-14}
58+
context 'default params' do
59+
let(:facts) do
60+
facts.merge(operatingsystem: 'Ubuntu', operatingsystemmajrelease: '14.04')
61+
end
62+
5063
it { is_expected.not_to contain_file('/lib/systemd/system/jira.service') }
5164
end
5265
end
66+
if os =~ %r{ubuntu-16}
67+
context 'default params' do
68+
let(:facts) do
69+
facts.merge(operatingsystem: 'Ubuntu', operatingsystemmajrelease: '16.04')
70+
end
71+
72+
it { is_expected.to contain_file('/lib/systemd/system/jira.service') }
73+
end
74+
end
5375
context 'overwriting service_manage param' do
5476
let(:params) do
5577
super().merge(service_manage: false)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<% @merged_jira_config_properties.sort.each do |key,value| -%>
2-
<%= key %> = <%= value %>
1+
<% @merged_jira_config_properties.sort.each do |key,value| -%>
2+
<%= key %> = <%= value %>
33
<% end -%>

0 commit comments

Comments
 (0)