Skip to content
This repository was archived by the owner on May 14, 2021. It is now read-only.

Add option to specify username while extracting #23

Open
wants to merge 2 commits 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
7 changes: 5 additions & 2 deletions manifests/extract.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# - *$extension: Default value '.tar.gz'.
# - *$timeout: Default value 120.
# - *$exec_path: Path being searched for all Exec resources, default: ['/usr/local/bin', '/usr/bin', '/bin']
# - *$user: Username to use when extracting
#
# Example usage:
#
Expand All @@ -35,7 +36,8 @@
$extension = 'tar.gz',
$timeout = 120,
$strip_components = 0,
$exec_path = ['/usr/local/bin', '/usr/bin', '/bin']) {
$exec_path = ['/usr/local/bin', '/usr/bin', '/bin'],
$user = undef) {

if $root_dir != '' {
$extract_dir = "${target}/${root_dir}"
Expand Down Expand Up @@ -67,7 +69,8 @@
command => $unpack_command,
path => $exec_path,
creates => $extract_dir,
timeout => $timeout
timeout => $timeout,
user => $user
}
}
absent: {
Expand Down
7 changes: 5 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
# - *$proxy: HTTP proxy in the form of "hostname:port"; e.g. "myproxy:8080"
# - *$dependency_class: Puppet class which installs the required programs (curl, tar, unzip)
# - *$exec_path: Path being searched for all Exec resources, default: ['/usr/local/bin', '/usr/bin', '/bin']
# - *$user: Username to use while extracting
#
# Example usage:
#
Expand Down Expand Up @@ -57,7 +58,8 @@
$password = undef,
$proxy = undef,
$dependency_class = Class['archive::prerequisites'],
$exec_path = ['/usr/local/bin', '/usr/bin', '/bin']) {
$exec_path = ['/usr/local/bin', '/usr/bin', '/bin'],
$user = undef) {

archive::download {"${name}.${extension}":
ensure => $ensure,
Expand Down Expand Up @@ -86,6 +88,7 @@
timeout => $timeout,
strip_components => $strip_components,
exec_path => $exec_path,
require => Archive::Download["${name}.${extension}"]
require => Archive::Download["${name}.${extension}"],
user => $user
}
}