Skip to content

Commit

Permalink
Merge pull request voxpupuli#70 from aswen/tbz2
Browse files Browse the repository at this point in the history
Add support for tbz2 filetype (same as tar.bz2).
  • Loading branch information
nanliu committed May 30, 2015
2 parents a71e7d6 + 262fbf9 commit 7154046
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions manifests/extract.pp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
}

if $strip {
if $::osfamily == 'Solaris' or $name !~ /(.tar|.tgz|.tar.gz|.tar.bz2)$/ {
if $::osfamily == 'Solaris' or $name !~ /(.tar|.tgz|.tar.gz|.tbz2|.tar.bz2)$/ {
warning('strip is only supported with GNU tar, ignoring the parameter')
$strip_opt = ''
} else {
Expand All @@ -86,7 +86,7 @@
}
}

/.tar.bz2$/: {
/(.tbz2|.tar.bz2)$/: {
$command = "tar xjf ${source_path}${strip_opt}"
}

Expand Down
15 changes: 15 additions & 0 deletions spec/defines/staging_extract_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@
}
end

describe 'when deploying tbz2' do
let(:title) { 'sample.tbz2' }
let(:params) { { :target => '/opt' } }

it {
should contain_file('/opt/staging')
should contain_exec('extract sample.tbz2').with({
:command => 'tar xjf /opt/staging//sample.tbz2',
:path => '/usr/local/bin:/usr/bin:/bin',
:cwd => '/opt',
:creates => '/opt/sample'
})
}
end

describe 'when deploying zip' do
let(:title) { 'sample.zip' }
let(:params) { { :target => '/opt' } }
Expand Down

0 comments on commit 7154046

Please sign in to comment.