Skip to content

Commit

Permalink
Remove support for the staging module
Browse files Browse the repository at this point in the history
  • Loading branch information
oranenj committed Apr 14, 2021
1 parent ec85b18 commit e716d57
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 99 deletions.
1 change: 0 additions & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
fixtures:
repositories:
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: 3 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ deploying the JIRA binaries.
```puppet
class { 'jira':
javahome => '/opt/java',
deploy_module => 'archive',
}
```

Expand Down Expand Up @@ -394,24 +393,16 @@ Defaults to `https://product-downloads.atlassian.com/software/jira/downloads/`

##### `checksum`

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

##### `$deploy_module`

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.
The md5 checksum of the archive file. Defaults to 'undef'

##### `$proxy_server`

Specify a proxy server, with port number if needed. ie: https://example.com:8080.
Only supported with `deploy_module => archive` (the default). Defaults to 'undef'.
Defaults to 'undef'.

##### `$proxy_type`

Proxy server type (none|http|https|ftp)
Only supported with `deploy_module => archive` (the default). Defaults to 'undef'.
Proxy server type (none|http|https|ftp). Defaults to 'undef'.

##### `$service_manage`

Expand Down
2 changes: 0 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@
Stdlib::HTTPUrl $download_url = 'https://product-downloads.atlassian.com/software/jira/downloads',
Optional[String] $checksum = undef,
Boolean $disable_notifications = false,
# Choose whether to use puppet-staging, or puppet-archive
$deploy_module = 'archive',
Optional[String] $proxy_server = undef,
Optional[Enum['none','http','https','ftp']] $proxy_type = undef,
# Manage service
Expand Down
79 changes: 23 additions & 56 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -74,54 +74,27 @@
}
}

case $jira::deploy_module {
'staging': {
require staging
staging::file { $file:
source => "${jira::download_url}/${file}",
timeout => 1800,
}
-> staging::extract { $file:
target => $jira::extractdir,
creates => "${jira::webappdir}/conf",
strip => 1,
user => $jira::user,
group => $jira::group,
notify => Exec["chown_${jira::extractdir}"],
before => File[$jira::homedir],
require => [
File[$jira::installdir],
User[$jira::user],
File[$jira::extractdir]],
}
}
'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_verify => $jira::checksum_verify,
checksum_type => 'md5',
checksum => $jira::checksum,
user => $jira::user,
group => $jira::group,
proxy_server => $jira::proxy_server,
proxy_type => $jira::proxy_type,
before => File[$jira::homedir],
require => [
File[$jira::installdir],
File[$jira::webappdir],
User[$jira::user],
],
}
}
default: {
fail('deploy_module parameter must equal "archive" or staging""')
}
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_verify => $jira::checksum_verify,
checksum_type => 'md5',
checksum => $jira::checksum,
user => $jira::user,
group => $jira::group,
proxy_server => $jira::proxy_server,
proxy_type => $jira::proxy_type,
before => File[$jira::homedir],
require => [
File[$jira::installdir],
File[$jira::webappdir],
User[$jira::user],
],
}

file { $jira::homedir:
Expand All @@ -137,14 +110,8 @@
}

if $jira::db == 'mysql' and $jira::mysql_connector_manage {
if $jira::deploy_module == 'archive' {
class { 'jira::mysql_connector':
require => Archive["/tmp/${file}"],
}
} elsif $jira::deploy_module == 'deploy' {
class { 'jira::mysql_connector':
require => Staging::Extract[$file],
}
class { 'jira::mysql_connector':
require => Archive["/tmp/${file}"],
}
contain jira::mysql_connector
}
Expand Down
29 changes: 15 additions & 14 deletions manifests/mysql_connector.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
$installdir = $jira::mysql_connector_install,
$download_url = $jira::mysql_connector_url
) {
require staging

assert_private()
$file = "${product}-${version}.${format}"

if ! defined(File[$installdir]) {
file { $installdir:
ensure => 'directory',
owner => root,
group => root,
before => Staging::File[$file],
before => Archive[$file],
}
}

Expand All @@ -25,18 +24,20 @@
$jarfile = "${product}-${version}.jar"
}

staging::file { $file:
source => "${download_url}/${file}",
timeout => 300,
}

-> staging::extract { $file:
target => $installdir,
creates => "${installdir}/${product}-${version}",
archive { $file:
ensure => present,
extract => true,
extract_path => $installdir,
source => "${download_url}/${file}",
creates => "${installdir}/${product}-${version}",
cleanup => true,
proxy_server => $jira::proxy_server,
proxy_type => $jira::proxy_type,
}

-> file { "${jira::webappdir}/lib/mysql-connector-java.jar":
ensure => link,
target => "${installdir}/${product}-${version}/${jarfile}",
file { "${jira::webappdir}/lib/mysql-connector-java.jar":
ensure => link,
target => "${installdir}/${product}-${version}/${jarfile}",
require => Archive[$file]
}
}
4 changes: 0 additions & 4 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
"name": "puppet/archive",
"version_requirement": ">= 1.0.0 < 5.0.0"
},
{
"name": "puppet/staging",
"version_requirement": ">= 2.0.1 < 4.0.0"
},
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 4.25.0 < 7.0.0"
Expand Down
18 changes: 9 additions & 9 deletions spec/classes/jira_mysql_connector_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
)
end
it 'deploys mysql connector 5.1.34 from tar.gz' do
is_expected.to contain_staging__file('mysql-connector-java-5.1.34.tar.gz').with('source' => 'https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.34.tar.gz')
is_expected.to contain_staging__extract('mysql-connector-java-5.1.34.tar.gz').with('target' => '/opt/MySQL-connector',
'creates' => '/opt/MySQL-connector/mysql-connector-java-5.1.34')
is_expected.to contain_archive('mysql-connector-java-5.1.34.tar.gz').with('source' => 'https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.34.tar.gz',
'extract_path' => '/opt/MySQL-connector',
'creates' => '/opt/MySQL-connector/mysql-connector-java-5.1.34')
end
end
context 'mysql connector defaults Connector Version >8' do
Expand All @@ -54,9 +54,9 @@
)
end
it 'deploys mysql connector 8.0.23 from tar.gz' do
is_expected.to contain_staging__file('mysql-connector-java-8.0.23.tar.gz').with('source' => 'https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-8.0.23.tar.gz')
is_expected.to contain_staging__extract('mysql-connector-java-8.0.23.tar.gz').with('target' => '/opt/MySQL-connector',
'creates' => '/opt/MySQL-connector/mysql-connector-java-8.0.23')
is_expected.to contain_archive('mysql-connector-java-8.0.23.tar.gz').with('source' => 'https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-8.0.23.tar.gz',
'target' => '/opt/MySQL-connector',
'extract_path' => '/opt/MySQL-connector/mysql-connector-java-8.0.23')
end
end
context 'mysql connector overwrite params' do
Expand All @@ -81,9 +81,9 @@
)
end
it 'deploys mysql connector 5.1.15 from zip' do
is_expected.to contain_staging__file('mysql-connector-java-5.1.15.zip').with('source' => 'http://example.co.za/foo/mysql-connector-java-5.1.15.zip')
is_expected.to contain_staging__extract('mysql-connector-java-5.1.15.zip').with('target' => '/opt/foo',
'creates' => '/opt/foo/mysql-connector-java-5.1.15')
is_expected.to contain_archive('mysql-connector-java-5.1.15.zip').with('source' => 'http://example.co.za/foo/mysql-connector-java-5.1.15.zip',
'extract_path' => '/opt/foo',
'creates' => '/opt/foo/mysql-connector-java-5.1.15')
end
end
context 'mysql_connector_mangage equals false' do
Expand Down
1 change: 0 additions & 1 deletion spec/default_module_facts.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
---
jira_version: '6.4'
staging_http_get: 'curl'

0 comments on commit e716d57

Please sign in to comment.