Skip to content

Commit

Permalink
Merge pull request #449 from treydock/extract_path
Browse files Browse the repository at this point in the history
Allow extract_path to be modified
  • Loading branch information
ghoneycutt committed May 18, 2020
2 parents 123cad5 + a4827cf commit 612b0db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion manifests/daemon.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
# Should puppet manage the service? (default true)
# @param extract_command
# Custom command passed to the archive resource to extract the downloaded archive.
# @param extract_path
# Path where to find extracted binary
# @param archive_bin_path
# Path to the binary in the downloaded archive.
# @param init_style
Expand Down Expand Up @@ -69,6 +71,7 @@
Hash[String, Scalar] $env_vars = {},
Optional[String] $env_file_path = $prometheus::env_file_path,
Optional[String[1]] $extract_command = $prometheus::extract_command,
Stdlib::Absolutepath $extract_path = '/opt',
Stdlib::Absolutepath $archive_bin_path = "/opt/${name}-${version}.${os}-${arch}/${name}",
Boolean $export_scrape_job = false,
Stdlib::Host $scrape_host = $facts['networking']['fqdn'],
Expand Down Expand Up @@ -97,7 +100,7 @@
archive { "/tmp/${name}-${version}.${download_extension}":
ensure => present,
extract => true,
extract_path => '/opt',
extract_path => $extract_path,
source => $real_download_url,
checksum_verify => false,
creates => $archive_bin_path,
Expand Down
8 changes: 8 additions & 0 deletions spec/defines/daemon_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@
)
}

context 'with overidden extract_path' do
let(:params) do
parameters.merge(extract_path: '/opt/foo')
end

it { is_expected.to contain_archive("/tmp/smurf_exporter-#{parameters[:version]}.tar.gz").with_extract_path('/opt/foo') }
end

# prometheus::config
if ['debian-7-x86_64'].include?(os)
# init_style = 'debian'
Expand Down

0 comments on commit 612b0db

Please sign in to comment.