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

Commit

Permalink
Include is enough, and fail if parameter/class not found
Browse files Browse the repository at this point in the history
  • Loading branch information
buzzdeee committed Sep 1, 2016
1 parent 88fb2cf commit e8bf214
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
16 changes: 7 additions & 9 deletions manifests/extract.pp
Original file line number Diff line number Diff line change
Expand Up @@ -41,30 +41,28 @@
$strip_components=0,
$purge=false,
$user=undef,
$tar_command=undef,
$tar_command=$::archive::params::tarcmd,
) {

require ::archive::params
include ::archive::params

if $root_dir {
$extract_dir = "${target}/${root_dir}"
} else {
$extract_dir = "${target}/${name}"
}

if $tar_command {
$real_tar_command = $tar_command
} else {
$real_tar_command = $::archive::params::tarcmd
if ! $tar_command {
fail("${module_name}: parameter \$tar_command not specified and \$::archive::params::tarcmd not found")
}

case $ensure {
'present': {

$extract_zip = "unzip -o ${src_target}/${name}.${extension} -d ${target}"
$extract_targz = "${real_tar_command} --no-same-owner --no-same-permissions --strip-components=${strip_components} -xzf ${src_target}/${name}.${extension} -C ${target}"
$extract_tarbz2 = "${real_tar_command} --no-same-owner --no-same-permissions --strip-components=${strip_components} -xjf ${src_target}/${name}.${extension} -C ${target}"
$extract_tarxz = "${real_tar_command} --no-same-owner --no-same-permissions --strip-components=${strip_components} -xpf ${src_target}/${name}.${extension} -C ${target}"
$extract_targz = "${tar_command} --no-same-owner --no-same-permissions --strip-components=${strip_components} -xzf ${src_target}/${name}.${extension} -C ${target}"
$extract_tarbz2 = "${tar_command} --no-same-owner --no-same-permissions --strip-components=${strip_components} -xjf ${src_target}/${name}.${extension} -C ${target}"
$extract_tarxz = "${tar_command} --no-same-owner --no-same-permissions --strip-components=${strip_components} -xpf ${src_target}/${name}.${extension} -C ${target}"

$purge_command = $purge ? {
true => "rm -rf ${target} && ",
Expand Down
2 changes: 0 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@
) {

include ::archive::params
Class['archive::params'] ->
Archive[$name]

archive::download {"${name}.${extension}":
ensure => $ensure,
Expand Down

0 comments on commit e8bf214

Please sign in to comment.