diff --git a/Puppetfile b/Puppetfile index dd479b48d..422afa60d 100644 --- a/Puppetfile +++ b/Puppetfile @@ -167,7 +167,7 @@ mod 'ssh', :git => 'https://github.com/saz/puppet-ssh.git' mod 'staging', - :commit => 'bc434a71e19aae54223d57c274e2e1a7f9546d5e', + :commit => '11dff0449dafdca5b6aa123b48932d9b52fdbec1', :git => 'https://github.com/nanliu/puppet-staging.git' mod 'stdlib', diff --git a/staging/manifests/deploy.pp b/staging/manifests/deploy.pp index 565038701..3c795482a 100644 --- a/staging/manifests/deploy.pp +++ b/staging/manifests/deploy.pp @@ -7,6 +7,7 @@ $certificate = undef, #: https certifcate file $password = undef, #: https or ftp user password or https certificate password $environment = undef, #: environment variable for settings such as http_proxy + $strip = undef, #: extract file with the --strip=X option. Only works with GNU tar. $timeout = undef, #: the time to wait for the file transfer to complete $user = undef, #: extract file as this user $group = undef, #: extract group as this group @@ -32,6 +33,7 @@ user => $user, group => $group, environment => $environment, + strip => $strip, subdir => $caller_module_name, creates => $creates, unless => $unless, diff --git a/staging/spec/defines/staging_deploy_spec.rb b/staging/spec/defines/staging_deploy_spec.rb index 2cfd33027..6b2eb03b1 100644 --- a/staging/spec/defines/staging_deploy_spec.rb +++ b/staging/spec/defines/staging_deploy_spec.rb @@ -24,4 +24,22 @@ } end + describe 'when deploying tar.gz with strip' do + let(:title) { 'sample.tar.gz' } + let(:params) { { :source => 'puppet:///modules/staging/sample.tar.gz', + :target => '/usr/local' , + :strip => 1, } } + + it { + should contain_file('/opt/staging') + should contain_file('/opt/staging/spec/sample.tar.gz') + should contain_exec('extract sample.tar.gz').with({ + :command => 'tar xzf /opt/staging/spec/sample.tar.gz --strip=1', + :path => '/usr/local/bin:/usr/bin:/bin', + :cwd => '/usr/local', + :creates => '/usr/local/sample' + }) + } + end + end