Skip to content

Commit

Permalink
update filename based on version
Browse files Browse the repository at this point in the history
  • Loading branch information
esalberg committed Sep 14, 2018
1 parent 755ac63 commit 5ecb24a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
24 changes: 16 additions & 8 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,35 @@
validate_string($version)
validate_string($base_url)

$groovy_filename = "groovy-binary-${version}.zip"
$groovy_dir = "${target}/groovy-${version}"

case $version {
/^1\./,/^2\.[0-3]{1}\./,/^2\.4\.[0-3]{1}$/: {
$filename = "groovy-binary-${version}.zip"
}
default: {
$filename = "apache-groovy-binary-${version}.zip"
}
}

if $manage_target and $manage_unzip {
$staging_require = [
Staging::File[$groovy_filename],
Staging::File[$filename],
File[$target],
Package['unzip'],
]
} elsif $manage_target {
$staging_require = [
Staging::File[$groovy_filename],
Staging::File[$filename],
File[$target],
]
} elsif $manage_unzip {
$staging_require = [
Staging::File[$groovy_filename],
Staging::File[$filename],
Package['unzip'],
]
} else {
$staging_require = Staging::File[$groovy_filename]
$staging_require = Staging::File[$filename]
}

file { '/etc/profile.d/groovy.sh':
Expand All @@ -59,8 +67,8 @@
content => template("${module_name}/groovy.csh.erb"),
}

staging::file { $groovy_filename:
source => "${base_url}/${groovy_filename}",
staging::file { $filename:
source => "${base_url}/${filename}",
timeout => $timeout,
}

Expand All @@ -74,7 +82,7 @@
}
}

staging::extract { $groovy_filename:
staging::extract { $filename:
target => $target,
creates => $groovy_dir,
require => $staging_require,
Expand Down
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# default parameters for the groovy class
class groovy::params {
$version = '2.3.1'
$base_url = 'http://dl.bintray.com/groovy/maven/'
$base_url = 'http://dl.bintray.com/groovy/maven'
$target = '/opt'
$manage_target = true
$manage_unzip = true
Expand Down

0 comments on commit 5ecb24a

Please sign in to comment.