Skip to content
This repository has been archived by the owner on Sep 2, 2020. It is now read-only.

Migrate from wget to archive module #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 23 additions & 19 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,30 @@
# ==Parameters
#
# [version] The Ant version to install.
class ant($version = $ant::params::version) inherits ant::params {
$srcdir = $ant::params::srcdir
class ant(
$version = $ant::params::version,
$srcdir = $ant::params::srcdir,
$checksum_verify = $ant::params::checksum_verify,
$checksum = $ant::params::checksum,
$proxy_server = $ant::params::proxy_server,
$proxy_type = $ant::params::proxy_type,

) inherits ant::params {
include 'archive'

case $::kernel {
'Linux': {
ensure_packages(['tar'])
Package['tar'] -> Exec['unpack-ant']
}
default: {}
}

wget::fetch { 'ant':
source => "http://archive.apache.org/dist/ant/binaries/apache-ant-${version}-bin.tar.gz",
destination => "${srcdir}/apache-ant-${version}-bin.tar.gz"
} ->
exec { 'unpack-ant':
command => "tar zxvf ${srcdir}/apache-ant-${version}-bin.tar.gz",
cwd => '/usr/share/',
creates => "/usr/share/apache-ant-${version}",
path => '/bin/:/usr/bin',
archive { "${srcdir}/apache-ant-${version}-bin.tar.gz":
ensure => present,
extract => true,
extract_command => 'tar zxvf %s',
extract_path => '/usr/share/',
source => "https://archive.apache.org/dist/ant/binaries/apache-ant-${version}-bin.tar.gz",
creates => "/usr/share/apache-ant-${version}",
cleanup => true,
checksum_verify => $checksum_verify,
checksum_type => 'md5',
checksum => $checksum,
proxy_server => $proxy_server,
proxy_type => $proxy_type,
} ->
file { '/usr/bin/ant':
ensure => link,
Expand Down
21 changes: 11 additions & 10 deletions manifests/ivy.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@
class ant::ivy($version = '2.2.0') {
include ant

wget::fetch { 'ivy':
source => "http://archive.apache.org/dist/ant/ivy/${version}/apache-ivy-${version}-bin.tar.gz",
destination => "${ant::srcdir}/apache-ivy-${version}-bin.tar.gz",
require => Class[ant],
} ->
exec { 'unpack-ivy':
command => "tar zxvf ${ant::srcdir}/apache-ivy-${version}-bin.tar.gz",
cwd => '/usr/share',
path => '/bin/:/usr/bin',
creates => "/usr/share/apache-ivy-${version}"
archive { "${ant::srcdir}/apache-ivy-${version}-bin.tar.gz":
ensure => present,
extract => true,
extract_command => 'tar zxvf %s',
extract_path => '/usr/share/',
source => "https://archive.apache.org/dist/ant/ivy/${version}/apache-ivy-${version}-bin.tar.gz",
creates => "/usr/share/apache-ivy-${version}",
cleanup => true,
proxy_server => $ant::params::proxy_server,
proxy_type => $ant::params::proxy_type,
require => Class['ant'],
} ->
file { "/usr/share/apache-ant-${ant::version}/lib/ivy-${version}.jar":
ensure => link,
Expand Down
14 changes: 9 additions & 5 deletions manifests/lib.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@

include ant::params

wget::fetch { "${name}-antlib":
source => $source_url,
destination => "/usr/share/apache-ant-${ant::params::version}/lib/${name}-${version}.jar",
require => Class['ant'],
archive { "/usr/share/apache-ant-${ant::params::version}/lib/${name}-${version}.jar":
ensure => present,
extract => false,
source => $source_url,
creates => "/usr/share/apache-ant-${ant::params::version}/lib/${name}-${version}.jar",
cleanup => false,
proxy_server => $ant::params::proxy_server,
proxy_type => $ant::params::proxy_type,
require => Class['ant'],
}

}
12 changes: 10 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# This class is used to define default parameters for the ant module.
#
class ant::params {
$srcdir = '/usr/local/src'
$version = '1.8.2'
$srcdir = '/usr/local/src'
$version = '1.10.8'
$checksum = undef
if $checksum == undef {
$checksum_verify = false
} else {
$checksum_verify = true
}
$proxy_server = undef
$proxy_type = undef
}