Rewrite install logic for modules and ROOT.war

Wildfly modules and the Zanata ROOT.war file installations were written with
execs for downloads and extraction. Switch to using the archive module.

Note: Use of md5sum for the war file is good practice and it's easy to find on
sourceforge when we update the module, but also has the added benefit of making
the archive module update our ROOT.war file if the md5sum changes, as it would
when we update the download URL for a new version. Just changing the URL won't
trigger an update to this file.

We should consider and test adding md5sum check for the Wildfly modules later,
but they aren't required right now.

Change-Id: I4223d37f5dcff5c53bd7166291eb2f3915cd9546
This commit is contained in:
Elizabeth K. Joseph 2015-08-24 12:49:45 -07:00
parent 803dbf11dd
commit 2e4c4cce6e
1 changed files with 26 additions and 57 deletions

View File

@ -28,6 +28,7 @@ class zanata(
$zanata_hibernate_url = 'https://sourceforge.net/projects/zanata/files/wildfly/wildfly-8.1.0.Final-module-hibernate-main-4.2.15.Final.zip',
$zanata_mojarra_url = 'https://sourceforge.net/projects/zanata/files/wildfly/wildfly-8.1.0.Final-module-mojarra-2.1.28.zip',
$zanata_url = 'https://sourceforge.net/projects/zanata/files/webapp/zanata-war-3.7.1.war',
$zanata_checksum = 'b741fac8cf7d11c9b15189e6899051eb',
$zanata_default_from_address,
$zanata_storage_dir = '/home/wildfly/zanata',
@ -72,67 +73,35 @@ class zanata(
group => 'wildfly'
}
exec { 'download_zanata':
command => "/usr/bin/wget ${zanata_url}",
cwd => '/home/wildfly',
creates => "/home/wildfly/${zanata_file}",
user => 'wildfly',
timeout => 600,
require => [
Package['wget'],
]
}
include '::archive'
file { '/opt/wildfly/standalone/deployments/ROOT.war':
ensure => present,
source => "/home/wildfly/${zanata_file}",
owner => 'wildfly',
require => [
archive { '/opt/wildfly/standalone/deployments/ROOT.war':
ensure => present,
user => 'wildfly',
source => $zanata_url,
checksum_type => 'md5',
checksum => $zanata_checksum,
require => [
Class['wildfly::install'],
Exec['download_zanata'],
]
}
exec { 'download_hibernate':
command => "/usr/bin/wget ${zanata_hibernate_url}",
cwd => '/home/wildfly',
creates => "/home/wildfly/${zanata_hibernate_file}",
user => 'wildfly',
timeout => 600,
require => [
Package['wget'],
]
archive { "/home/wildfly/${zanata_hibernate_file}":
ensure => present,
user => 'wildfly',
source => $zanata_hibernate_url,
extract => true,
extract_path => '/opt/wildfly/',
require => Package['unzip'],
}
exec { 'unzip_hibernate':
command => "/usr/bin/unzip -o ${zanata_hibernate_file} -d /opt/wildfly/",
cwd => '/home/wildfly',
user => 'wildfly',
require => [
Exec['download_hibernate'],
Package['unzip'],
]
}
exec { 'download_mojarra':
command => "/usr/bin/wget ${zanata_mojarra_url}",
cwd => '/home/wildfly',
creates => "/home/wildfly/${zanata_mojarra_file}",
user => 'wildfly',
timeout => 600,
require => [
Package['wget'],
]
}
exec { 'unzip_mojarra':
command => "/usr/bin/unzip -o ${zanata_mojarra_file} -d /opt/wildfly/",
cwd => '/home/wildfly',
user => 'wildfly',
require => [
Exec['download_mojarra'],
Package['unzip'],
]
archive { "/home/wildfly/${zanata_mojarra_file}":
ensure => present,
user => 'wildfly',
source => $zanata_mojarra_url,
extract => true,
extract_path => '/opt/wildfly/',
require => Package['unzip'],
}
file { '/opt/wildfly/standalone/deployments/mysql-connector-java.jar':
@ -152,9 +121,9 @@ class zanata(
content => template('zanata/standalone.xml.erb'),
require => [
Class['zanata::wildfly'],
File['/opt/wildfly/standalone/deployments/ROOT.war'],
Exec['unzip_mojarra'],
Exec['unzip_hibernate'],
Archive['/opt/wildfly/standalone/deployments/ROOT.war'],
Archive["/home/wildfly/${zanata_mojarra_file}"],
Archive["/home/wildfly/${zanata_hibernate_file}"],
],
}
}