Skip to content

Commit

Permalink
Use module voxpupuli/archive instead of mkrakowitzer/deploy. This sho…
Browse files Browse the repository at this point in the history
…uld fix #84
  • Loading branch information
dhoppe committed Mar 22, 2016
1 parent a2b3695 commit 3728460
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 91 deletions.
6 changes: 3 additions & 3 deletions .fixtures.yml
Expand Up @@ -2,6 +2,6 @@ fixtures:
symlinks:
jira: "#{source_dir}"
repositories:
deploy: "https://github.com/mkrakowitzer/puppet-deploy"
staging: "https://github.com/nanliu/puppet-staging"
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib"
archive: "https://github.com/voxpupuli/puppet-archive.git"
staging: "https://github.com/voxpupuli/puppet-staging.git"
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
15 changes: 8 additions & 7 deletions README.md
Expand Up @@ -80,12 +80,12 @@ Jira can be upgraded by incrementing this version number. This will *STOP* the r
```

######Upgrades to the JIRA puppet Module
mkrakowitzer-deploy has been replaced with nanliu-staging as the default module for deploying the JIRA binaries. You can still use mkrakowitzer-deploy with the *staging_or_deploy => 'deploy'*
mkrakowitzer-deploy has been replaced with nanliu-staging as the default module for deploying the JIRA binaries. You can still use mkrakowitzer-deploy with the *deploy_module => 'archive'*

```puppet
class { 'jira':
javahome => '/opt/java',
staging_or_deploy => 'deploy',
javahome => '/opt/java',
deploy_module => 'archive',
}
```

Expand Down Expand Up @@ -322,11 +322,12 @@ defaults to ''
The URL used to download the JIRA installation file.
Defaults to 'https://downloads.atlassian.com/software/jira/downloads/'

#####`$staging_or_deploy`
#####`checksum`
The md5 checksum of the archive file. Only supported with `deploy_module => archive`. Defaults to 'undef'

#####`$deploy_module`

Choose whether to use nanliu-staging, or mkrakowitzer-deploy.
Defaults to 'staging' to use nanliu-staging as it is puppetlabs approved.
Alternative option is 'deploy' to use mkrakowitzer-deploy.
Module to use for downloading and extracting archive file. Supports puppet-archive and puppet-staging. Defaults to 'archive'. Archive supports md5 hash checking and Staging supports S3 buckets.

#####`$service_manage`

Expand Down
6 changes: 3 additions & 3 deletions manifests/init.pp
Expand Up @@ -96,11 +96,11 @@

# Misc Settings
$download_url = 'https://downloads.atlassian.com/software/jira/downloads/',
$checksum = undef,
$disable_notifications = false,

# Choose whether to use nanliu-staging, or mkrakowitzer-deploy
# Defaults to nanliu-staging as it is puppetlabs approved.
$staging_or_deploy = 'staging',
# Choose whether to use puppet-staging, or puppet-archive
$deploy_module = 'archive',

# Manage service
$service_manage = true,
Expand Down
99 changes: 54 additions & 45 deletions manifests/install.pp
Expand Up @@ -15,6 +15,8 @@
# -----------------------------------------------------------------------------
class jira::install {

include '::archive'

group { $jira::group:
ensure => present,
gid => $jira::gid,
Expand Down Expand Up @@ -51,52 +53,59 @@
$file = "atlassian-${jira::product_name}-${jira::version}-jira-${jira::version}.${jira::format}"
}

if $jira::staging_or_deploy == 'staging' {

require staging
if ! defined(File[$jira::webappdir]) {
file { $jira::webappdir:
ensure => 'directory',
owner => $jira::user,
group => $jira::group,
}
}

if ! defined(File[$jira::webappdir]) {
file { $jira::webappdir:
ensure => 'directory',
owner => $jira::user,
group => $jira::group,
case $jira::deploy_module {
'staging': {
require staging
staging::file { $file:
source => "${jira::download_url}/${file}",
timeout => 1800,
} ->
staging::extract { $file:
target => $jira::webappdir,
creates => "${jira::webappdir}/conf",
strip => 1,
user => $jira::user,
group => $jira::group,
notify => Exec["chown_${jira::webappdir}"],
before => File[$jira::homedir],
require => [
File[$jira::installdir],
User[$jira::user],
File[$jira::webappdir] ],
}
}

staging::file { $file:
source => "${jira::download_url}/${file}",
timeout => 1800,
} ->

staging::extract { $file:
target => $jira::webappdir,
creates => "${jira::webappdir}/conf",
strip => 1,
user => $jira::user,
group => $jira::group,
notify => Exec["chown_${jira::webappdir}"],
before => File[$jira::homedir],
require => [
File[$jira::installdir],
User[$jira::user],
File[$jira::webappdir] ],
'archive': {
archive { "/tmp/${file}":
ensure => present,
extract => true,
extract_command => 'tar xfz %s --strip-components=1',
extract_path => $jira::webappdir,
source => "${jira::download_url}/${file}",
creates => "${jira::webappdir}/conf",
cleanup => true,
checksum_type => 'md5',
checksum => $jira::checksum,
user => $jira::user,
group => $jira::group,
before => File[$jira::homedir],
require => [
File[$jira::installdir],
File[$jira::webappdir],
User[$jira::user],
],
}
}
} elsif $jira::staging_or_deploy == 'deploy' {

deploy::file { $file:
target => $jira::webappdir,
url => $jira::download_url,
strip => true,
download_timout => 1800,
owner => $jira::user,
group => $jira::group,
notify => Exec["chown_${jira::webappdir}"],
before => File[$jira::homedir],
require => [ File[$jira::installdir], User[$jira::user] ],
default: {
fail('deploy_module parameter must equal "archive" or staging""')
}

} else {
fail('staging_or_deploy must equal "staging" or "deploy"')
}

file { $jira::homedir:
Expand All @@ -112,13 +121,13 @@
}

if $jira::db == 'mysql' and $jira::mysql_connector_manage {
if $jira::staging_or_deploy == 'staging' {
if $jira::deploy_module == 'archive' {
class { '::jira::mysql_connector':
require => Staging::Extract[$file],
require => Archive["/tmp/${file}"],
}
} elsif $jira::staging_or_deploy == 'deploy' {
} elsif $jira::deploy_module == 'deploy' {
class { '::jira::mysql_connector':
require => Deploy::File[$file],
require => Staging::Extract[$file],
}
}
contain ::jira::mysql_connector
Expand Down
12 changes: 6 additions & 6 deletions metadata.json
Expand Up @@ -11,16 +11,16 @@
"tags": ["jira"],
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 3.0.0"
"name": "puppet/archive",
"version_requirement": ">= 0.4.4"
},
{
"name": "mkrakowitzer/deploy",
"version_requirement": ">= 0.0.3"
"name": "puppet/staging",
"version_requirement": ">= 1.0.0"
},
{
"name": "nanliu/staging",
"version_requirement": ">= 1.0.0"
"name": "puppetlabs/stdlib",
"version_requirement": ">= 3.0.0"
}
],
"requirements": [
Expand Down
Expand Up @@ -19,20 +19,22 @@
:homedir => '/home/jira',
:format => 'tar.gz',
:product => 'jira',
:version => '6.4.3a',
:version => '6.3.4a',
:download_url => 'https://downloads.atlassian.com/software/jira/downloads',
}
end
it { should contain_group('jira') }
it { should contain_user('jira').with_shell('/bin/true') }
it 'should deploy jira 6.4.3a from tar.gz' do
should contain_staging__file('atlassian-jira-6.4.3a.tar.gz').with('source' => 'https://downloads.atlassian.com/software/jira/downloads/atlassian-jira-6.4.3a.tar.gz')
should contain_staging__extract('atlassian-jira-6.4.3a.tar.gz').with('target' => '/opt/jira/atlassian-jira-6.4.3a-standalone',
'creates' => '/opt/jira/atlassian-jira-6.4.3a-standalone/conf',
'strip' => '1',
'user' => 'jira',
'group' => 'jira')
it 'should deploy jira 6.3.4a from tar.gz' do
should contain_archive('/tmp/atlassian-jira-6.3.4a.tar.gz')
.with('extract_path' => '/opt/jira/atlassian-jira-6.3.4a-standalone',
'source' => 'https://downloads.atlassian.com/software/jira/downloads/atlassian-jira-6.3.4a.tar.gz',
'creates' => '/opt/jira/atlassian-jira-6.3.4a-standalone/conf',
'user' => 'jira',
'group' => 'jira',
'checksum_type' => 'md5',)
end

it 'should manage the jira home directory' do
should contain_file('/home/jira').with('ensure' => 'directory',
'owner' => 'jira',
Expand All @@ -51,10 +53,14 @@
:download_url => 'http://www.atlassian.com/software/jira/downloads/binary',
}
end
it 'should deploy jira-software 7.0.4 from tar.gz' do
should contain_staging__file('atlassian-jira-software-7.0.4-jira-7.0.4.tar.gz').with('source' => 'http://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-software-7.0.4-jira-7.0.4.tar.gz')
should contain_staging__extract('atlassian-jira-software-7.0.4-jira-7.0.4.tar.gz').with('target' => '/opt/jira/atlassian-jira-software-7.0.4-standalone',
'creates' => '/opt/jira/atlassian-jira-software-7.0.4-standalone/conf')
it 'should deploy jira 7.0.4 from tar.gz' do
should contain_archive('/tmp/atlassian-jira-software-7.0.4-jira-7.0.4.tar.gz')
.with('extract_path' => '/opt/jira/atlassian-jira-software-7.0.4-standalone',
'source' => 'http://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-software-7.0.4-jira-7.0.4.tar.gz',
'creates' => '/opt/jira/atlassian-jira-software-7.0.4-standalone/conf',
'user' => 'jira',
'group' => 'jira',
'checksum_type' => 'md5',)
end
end
context 'core product' do
Expand All @@ -67,10 +73,14 @@
:download_url => 'http://www.atlassian.com/software/jira/downloads/binary',
}
end
it 'should deploy jira-core 7.0.4 from tar.gz' do
should contain_staging__file('atlassian-jira-core-7.0.4.tar.gz').with('source' => 'http://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-core-7.0.4.tar.gz')
should contain_staging__extract('atlassian-jira-core-7.0.4.tar.gz').with('target' => '/opt/jira/atlassian-jira-core-7.0.4-standalone',
'creates' => '/opt/jira/atlassian-jira-core-7.0.4-standalone/conf')
it 'should deploy jira 7.0.4 from tar.gz' do
should contain_archive('/tmp/atlassian-jira-core-7.0.4.tar.gz')
.with('extract_path' => '/opt/jira/atlassian-jira-core-7.0.4-standalone',
'source' => 'http://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-core-7.0.4.tar.gz',
'creates' => '/opt/jira/atlassian-jira-core-7.0.4-standalone/conf',
'user' => 'jira',
'group' => 'jira',
'checksum_type' => 'md5',)
end
end
end
Expand Down Expand Up @@ -100,12 +110,13 @@
it { should contain_group('bar') }

it 'should deploy jira 6.0.0 from tar.gz' do
should contain_staging__file('atlassian-jira-6.0.0.tar.gz').with('source' => 'http://downloads.atlassian.com/atlassian-jira-6.0.0.tar.gz')
should contain_staging__extract('atlassian-jira-6.0.0.tar.gz').with('target' => '/opt/jira/atlassian-jira-6.0.0-standalone',
'creates' => '/opt/jira/atlassian-jira-6.0.0-standalone/conf',
'strip' => '1',
'user' => 'foo',
'group' => 'bar')
should contain_archive('/tmp/atlassian-jira-6.0.0.tar.gz')
.with('extract_path' => '/opt/jira/atlassian-jira-6.0.0-standalone',
'source' => 'http://downloads.atlassian.com/atlassian-jira-6.0.0.tar.gz',
'creates' => '/opt/jira/atlassian-jira-6.0.0-standalone/conf',
'user' => 'foo',
'group' => 'bar',
'checksum_type' => 'md5',)
end

it 'should manage the jira home directory' do
Expand Down
10 changes: 5 additions & 5 deletions spec/spec_helper_acceptance.rb
Expand Up @@ -35,12 +35,12 @@
on host, '/usr/sbin/locale-gen'
on host, '/usr/sbin/update-locale'
end
on host, puppet('module', 'install', 'puppetlabs-stdlib'), :acceptable_exit_codes => [0, 1]
on host, puppet('module', 'install', 'puppetlabs-postgresql'), :acceptable_exit_codes => [0, 1]
on host, puppet('module', 'install', 'puppetlabs-mysql'), :acceptable_exit_codes => [0, 1]
on host, puppet('module', 'install', 'puppet-archive'), :acceptable_exit_codes => [0, 1]
on host, puppet('module', 'install', 'puppetlabs-java_ks'), :acceptable_exit_codes => [0, 1]
on host, puppet('module', 'install', 'mkrakowitzer-deploy'), :acceptable_exit_codes => [0, 1]
on host, puppet('module', 'install', 'nanliu-staging'), :acceptable_exit_codes => [0, 1]
on host, puppet('module', 'install', 'puppetlabs-mysql'), :acceptable_exit_codes => [0, 1]
on host, puppet('module', 'install', 'puppetlabs-postgresql'), :acceptable_exit_codes => [0, 1]
on host, puppet('module', 'install', 'puppet-staging'), :acceptable_exit_codes => [0, 1]
on host, puppet('module', 'install', 'puppetlabs-stdlib'), :acceptable_exit_codes => [0, 1]
end
end
end

0 comments on commit 3728460

Please sign in to comment.