Skip to content

Commit

Permalink
Merge pull request voxpupuli#46 from brycejohnson/f3792625/1.1.4
Browse files Browse the repository at this point in the history
F3792625/1.1.4
  • Loading branch information
mkrakowitzer committed Jan 17, 2015
2 parents 731d11f + 5c3e0a0 commit b3f2519
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 16 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
##2014-11-18 - Release 1.1.4
- Parameterize the lockfile variable in the init script
- Autoinstall MySql Connector/J Driver
- Add parameter stop_jira
- Fix bug on RHEL7 where updating the systemd script does not take effect without refreshing systemd

Thanks to MasonM for his contributions

##2014-11-17 - Release 1.1.3
- Refactor beaker tests to that they are portable and other people can run them
- Remove unnecessary comments from init.pp
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ Manage the JIRA service, defaults to 'running'

Defaults to 'true'

#####`$stop_jira`
If the jira service is managed outside of puppet the stop_jira paramater can be used to shut down jira for upgrades. Defaults to 'service jira stop && sleep 15'

#####`$proxy = {}`

Defaults to {}, See examples on how to use.
Expand Down
6 changes: 3 additions & 3 deletions manifests/facts.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
# class { 'jira::facts': }
#
class jira::facts(
$ensure = 'present',
$port = $jira::tomcatPort,
$uri = '127.0.0.1',
$ensure = 'present',
$port = $jira::tomcatPort,
$uri = '127.0.0.1',
$json_packages = $jira::params::json_packages,
) inherits jira::params {

Expand Down
8 changes: 5 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@
$service_manage = true,
$service_ensure = running,
$service_enable = true,
# Command to stop jira in preparation to updgrade. This is configurable
# incase the jira service is managed outside of puppet. eg: using the
# puppetlabs-corosync module: 'crm resource stop jira && sleep 15'
$stop_jira = 'service jira stop && sleep 15',

# Tomcat
$tomcatPort = 8080,
Expand All @@ -103,8 +107,6 @@

) inherits jira::params {

Exec { path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ] }

if $jira::db != 'postgresql' and $jira::db != 'mysql' {
fail('jira db parameter must be postgresql or mysql')
}
Expand All @@ -114,7 +116,7 @@
# Shut it down in preparation for upgrade.
if versioncmp($version, $::jira_version) > 0 {
notify { 'Attempting to upgrade JIRA': }
exec { 'service jira stop && sleep 15': before => Anchor['jira::start'] }
exec { $stop_jira: before => Anchor['jira::start'] }
}
}

Expand Down
3 changes: 3 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# Defines default values for jira module
#
class jira::params {

Exec { path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ] }

case "${::osfamily}${::operatingsystemmajrelease}" {
/RedHat7/: {
$json_packages = 'rubygem-json'
Expand Down
16 changes: 14 additions & 2 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,26 @@
file { $service_file_location:
content => template($service_file_template),
mode => '0755',
before => Service['jira'],
}

if $service_manage {

validate_string($service_ensure)
validate_bool($service_enable)

if $::osfamily == 'RedHat' and $::operatingsystemmajrelease == '7' {
exec { 'refresh_systemd':
command => 'systemctl daemon-reload',
refreshonly => true,
subscribe => File[$service_file_location],
before => Service['jira'],
}
}

service { 'jira':
ensure => $service_ensure,
enable => $service_enable,
require => Class['jira::config'],
require => File[$service_file_location],
}
}
}
6 changes: 3 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "mkrakowitzer-jira",
"version": "1.1.3",
"version": "1.1.4",
"author": "brycejohnson",
"summary": "Module to install Jira",
"license": "Apache License, Version 2.0",
"license": "Apache-2.0",
"source": "https://github.com/brycejohnson/puppet-jira.git",
"project_page": "https://github.com/brycejohnson/puppet-jira/blob/master/README.md",
"issues_url": "https://github.com/brycejohnson/puppet-jira/issues",
Expand All @@ -25,7 +25,7 @@
"requirements": [
{
"name": "pe",
"version_requirement": "3.x"
"version_requirement": ">=3.0.0 <4.0.0"
},
{
"name": "puppet",
Expand Down
50 changes: 49 additions & 1 deletion spec/classes/jira_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,55 @@
it { should contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/bin/setenv.sh')}
it { should contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/bin/user.sh')}
it { should contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/conf/server.xml')}
it { should contain_file('/home/jira/dbconfig.xml')}
it { should contain_file('/home/jira/dbconfig.xml')
.with_content(/<url>jdbc:postgresql:\/\/localhost:5432\/jira<\/url>/) }

end
context 'mysql params' do
let(:params) {{
:version => '6.3.4a',
:javahome => '/opt/java',
:db => 'mysql',
}}
it { should contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/bin/setenv.sh')}
it { should contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/bin/user.sh')}
it { should contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/conf/server.xml')}
it { should contain_file('/home/jira/dbconfig.xml')
.with_content(/<url>jdbc:mysql:\/\/localhost:5432\/jira\?useUnicode=true&amp;characterEncoding=UTF8&amp;sessionVariables=storage_engine=InnoDB<\/url>/) }
it { should contain_package('mysql-connector-java').with_ensure('installed')}
it { should contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/lib/mysql-connector-java.jar')
.with(
'ensure' => 'link',
'target' => '/usr/share/java/mysql-connector-java.jar',
)
}
end
context 'mysql params on Debian' do
let(:facts) { {
:osfamily => 'Debian',
}}
let(:params) {{
:version => '6.3.4a',
:javahome => '/opt/java',
:db => 'mysql',
}}
it { should contain_package('libmysql-java').with_ensure('installed')}
it { should contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/lib/mysql-connector-java.jar')
.with(
'ensure' => 'link',
'target' => '/usr/share/java/mysql.jar',
)
}
end
context 'custom dburl' do
let(:params) {{
:version => '6.3.4a',
:javahome => '/opt/java',
:dburl => 'my custom dburl',
}}
it { should contain_file('/home/jira/dbconfig.xml')
.with_content(/<url>my custom dburl<\/url>/) }
end

end
end
24 changes: 20 additions & 4 deletions spec/classes/jira_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,34 @@
}}
it { should contain_service('jira')}
it { should contain_file('/etc/init.d/jira')
.with_content(/Short-Description: Start up JIRA/) }
.with_content(/Short-Description: Start up JIRA/)
.with_content(/lockfile=\/var\/lock\/subsys\/jira/)
}
it { should_not contain_file('/usr/lib/systemd/system/jira.service')
.with_content(/Atlassian Systemd Jira Service/) }
it { should_not contain_exec('refresh_systemd') }
end
context 'lockfile on Debian' do
let(:params) {{
:javahome => '/opt/java',
}}
let(:facts) {{
:osfamily => 'Debian',
}}
it { should contain_file('/etc/init.d/jira')
.with_content(/\/var\/lock\/jira/) }
end
context 'overwriting service_manage param' do
let(:params) {{
:service_manage => false,
:javahome => '/opt/java',
:javahome => '/opt/java',
}}
it { should_not contain_service('jira')}
end
context 'overwriting service_manage param with bad boolean' do
let(:params) {{
:service_manage => 'false',
:javahome => '/opt/java',
:javahome => '/opt/java',
}}
it do
expect {
Expand All @@ -30,7 +45,7 @@
end
context 'overwriting service params' do
let(:params) {{
:javahome => '/opt/java',
:javahome => '/opt/java',
:service_ensure => 'stopped',
:service_enable => false,
}}
Expand All @@ -49,6 +64,7 @@
}}
it { should contain_file('/usr/lib/systemd/system/jira.service')
.with_content(/Atlassian Systemd Jira Service/) }
it { should contain_exec('refresh_systemd') }
end

end
Expand Down
11 changes: 11 additions & 0 deletions spec/classes/jira_upgrade_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,16 @@
}}
it { should contain_exec('service jira stop && sleep 15') }
end
context 'custom params' do
let(:params) {{
:javahome => '/opt/java',
:stop_jira => 'stop service please'
}}
let(:facts) { {
:jira_version => "5.0.0",
}}
it { should contain_exec('stop service please') }
end

end
end

0 comments on commit b3f2519

Please sign in to comment.