From dbae27b6a779ba7f5aa6d2a565643a8bdb869a79 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Mon, 11 May 2015 13:38:18 +0200 Subject: [PATCH] Update staging to a71e7d6261616fdba9f5c9109c4ad41c120d91be a71e7d6261616fdba9f5c9109c4ad41c120d91be Merge pull request #68 from nanliu/puppet4 8c16b66d593028cb383fcebca8dc5bae879880ae Remove testing of caller_module_name in future parser. 72fbe4afe884b7f256a87eb87f64b6194be4a9e3 Add future parser and remove puppet 4 restrictions. 9c1c08af301dabe35c0d95ee7de9ab6ef2343139 Merge pull request #66 from csykora/master d713efc3ab07ab2171fedafc1a814cb3e45031dd Added quotes around source and target for powershell downloads 986834e057c1c134cf8310a605ccdc2c627f1ffd Merge pull request #65 from csykora/master c1cd606aa7c38231d476a5cec4ed2cc31c1466f9 Fix for powershell download failing --- Puppetfile | 2 +- staging/.travis.yml | 6 +- staging/manifests/file.pp | 4 +- staging/metadata.json | 14 ++-- staging/spec/defines/staging_deploy_spec.rb | 37 ++++++----- staging/spec/defines/staging_extract_spec.rb | 19 +++--- staging/spec/defines/staging_file_spec.rb | 67 ++++++++++---------- 7 files changed, 81 insertions(+), 68 deletions(-) diff --git a/Puppetfile b/Puppetfile index d082ee7fd..ee2de6f5b 100644 --- a/Puppetfile +++ b/Puppetfile @@ -183,7 +183,7 @@ mod 'ssh', :git => 'https://github.com/saz/puppet-ssh.git' mod 'staging', - :commit => '11dff0449dafdca5b6aa123b48932d9b52fdbec1', + :commit => 'a71e7d6261616fdba9f5c9109c4ad41c120d91be', :git => 'https://github.com/nanliu/puppet-staging.git' mod 'stdlib', diff --git a/staging/.travis.yml b/staging/.travis.yml index ca688afab..f089f1bb6 100644 --- a/staging/.travis.yml +++ b/staging/.travis.yml @@ -10,7 +10,11 @@ matrix: env: PUPPET_GEM_VERSION="~> 3.3.0" FACTER_GEM_VERSION="~> 1.7.0" - rvm: 1.9.3 env: PUPPET_GEM_VERSION="~> 3.0" - - rvm: 2.0.0 + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + - rvm: 2.1.5 env: PUPPET_GEM_VERSION="~> 3.0" + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" notifications: email: false diff --git a/staging/manifests/file.pp b/staging/manifests/file.pp index adda4d957..be48a2e38 100644 --- a/staging/manifests/file.pp +++ b/staging/manifests/file.pp @@ -71,8 +71,8 @@ 'powershell':{ $http_get = "powershell.exe -Command \"\$wc = New-Object System.Net.WebClient;\$wc.DownloadFile('${source}','${target_file}')\"" $ftp_get = $http_get - $http_get_password = "powershell.exe -Command \"\$wc = (New-Object System.Net.WebClient);\$wc.Credentials = New-Object System.Net.NetworkCredential('${username}','${password}');\$wc.DownloadFile(${source},${target_file})\"" - $ftp_get_password = $http_get_password + $http_get_passwd = "powershell.exe -Command \"\$wc = New-Object System.Net.WebClient;\$wc.Credentials = New-Object System.Net.NetworkCredential('${username}','${password}');\$wc.DownloadFile('${source}','${target_file}')\"" + $ftp_get_passwd = $http_get_passwd } } diff --git a/staging/metadata.json b/staging/metadata.json index eb5b2d866..a889487af 100644 --- a/staging/metadata.json +++ b/staging/metadata.json @@ -5,7 +5,8 @@ "operatingsystemrelease": [ "4", "5", - "6" + "6", + "7" ] }, { @@ -13,7 +14,8 @@ "operatingsystemrelease": [ "4", "5", - "6" + "6", + "7" ] }, { @@ -21,7 +23,8 @@ "operatingsystemrelease": [ "4", "5", - "6" + "6", + "7" ] }, { @@ -29,7 +32,8 @@ "operatingsystemrelease": [ "4", "5", - "6" + "6", + "7" ] }, { @@ -88,7 +92,7 @@ }, { "name": "puppet", - "version_requirement": ">=2.7.0 <4.0.0" + "version_requirement": ">=2.7.0" } ], "name": "nanliu-staging", diff --git a/staging/spec/defines/staging_deploy_spec.rb b/staging/spec/defines/staging_deploy_spec.rb index 6b2eb03b1..a2092a21d 100644 --- a/staging/spec/defines/staging_deploy_spec.rb +++ b/staging/spec/defines/staging_deploy_spec.rb @@ -1,22 +1,25 @@ require 'spec_helper' describe 'staging::deploy', :type => :define do - # forcing a more sane caller_module_name to match real usage. - let(:facts) { { :caller_module_name => 'spec', - :osfamily => 'RedHat', - :staging_http_get => 'curl', - :path => '/usr/local/bin:/usr/bin:/bin', } } + let(:facts) {{ + :caller_module_name => '', + :osfamily => 'RedHat', + :staging_http_get => 'curl', + :path => '/usr/local/bin:/usr/bin:/bin', + }} describe 'when deploying tar.gz' do let(:title) { 'sample.tar.gz' } - let(:params) { { :source => 'puppet:///modules/staging/sample.tar.gz', - :target => '/usr/local' } } + let(:params) {{ + :source => 'puppet:///modules/staging/sample.tar.gz', + :target => '/usr/local' + }} + it { should contain_file('/opt/staging') } + it { should contain_file('/opt/staging//sample.tar.gz') } 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', + :command => 'tar xzf /opt/staging//sample.tar.gz', :path => '/usr/local/bin:/usr/bin:/bin', :cwd => '/usr/local', :creates => '/usr/local/sample' @@ -26,15 +29,17 @@ 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, } } + let(:params) {{ + :source => 'puppet:///modules/staging/sample.tar.gz', + :target => '/usr/local' , + :strip => 1 + }} + it { should contain_file('/opt/staging') } + it { should contain_file('/opt/staging//sample.tar.gz') } 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', + :command => 'tar xzf /opt/staging//sample.tar.gz --strip=1', :path => '/usr/local/bin:/usr/bin:/bin', :cwd => '/usr/local', :creates => '/usr/local/sample' diff --git a/staging/spec/defines/staging_extract_spec.rb b/staging/spec/defines/staging_extract_spec.rb index 84186b997..319d0813a 100644 --- a/staging/spec/defines/staging_extract_spec.rb +++ b/staging/spec/defines/staging_extract_spec.rb @@ -2,9 +2,10 @@ describe 'staging::extract', :type => :define do # forcing a more sane caller_module_name to match real usage. - let(:facts) { { :caller_module_name => 'spec', - :osfamily => 'RedHat', - :path => '/usr/local/bin:/usr/bin:/bin' } } + let(:facts) {{ + :osfamily => 'RedHat', + :path => '/usr/local/bin:/usr/bin:/bin' + }} describe 'when deploying tar.gz' do let(:title) { 'sample.tar.gz' } @@ -13,7 +14,7 @@ it { should contain_file('/opt/staging') should contain_exec('extract sample.tar.gz').with({ - :command => 'tar xzf /opt/staging/spec/sample.tar.gz', + :command => 'tar xzf /opt/staging//sample.tar.gz', :path => '/usr/local/bin:/usr/bin:/bin', :cwd => '/opt', :creates => '/opt/sample' @@ -29,7 +30,7 @@ it { should contain_file('/opt/staging') should contain_exec('extract sample.tar.gz').with({ - :command => 'tar xzf /opt/staging/spec/sample.tar.gz --strip=1', + :command => 'tar xzf /opt/staging//sample.tar.gz --strip=1', :path => '/usr/local/bin:/usr/bin:/bin', :cwd => '/opt', :creates => '/opt/sample' @@ -43,7 +44,7 @@ it { should contain_file('/opt/staging') should contain_exec('extract sample.zip').with({ - :command => 'unzip /opt/staging/spec/sample.zip', + :command => 'unzip /opt/staging//sample.zip', :path => '/usr/local/bin:/usr/bin:/bin', :cwd => '/opt', :creates => '/opt/sample' @@ -58,7 +59,7 @@ it { should contain_file('/opt/staging') should contain_exec('extract sample.zip').with({ - :command => 'unzip /opt/staging/spec/sample.zip', + :command => 'unzip /opt/staging//sample.zip', :path => '/usr/local/bin:/usr/bin:/bin', :cwd => '/opt', :creates => '/opt/sample' @@ -72,7 +73,7 @@ it { should contain_file('/opt/staging') should contain_exec('extract sample.war').with({ - :command => 'jar xf /opt/staging/spec/sample.war', + :command => 'jar xf /opt/staging//sample.war', :path => '/usr/local/bin:/usr/bin:/bin', :cwd => '/opt', :creates => '/opt/sample' @@ -87,7 +88,7 @@ it { should contain_file('/opt/staging') should contain_exec('extract sample.war').with({ - :command => 'jar xf /opt/staging/spec/sample.war', + :command => 'jar xf /opt/staging//sample.war', :path => '/usr/local/bin:/usr/bin:/bin', :cwd => '/opt', :creates => '/opt/sample' diff --git a/staging/spec/defines/staging_file_spec.rb b/staging/spec/defines/staging_file_spec.rb index 2eee396a1..8a4b81433 100644 --- a/staging/spec/defines/staging_file_spec.rb +++ b/staging/spec/defines/staging_file_spec.rb @@ -2,12 +2,11 @@ describe 'staging::file', :type => :define do # forcing a more sane caller_module_name to match real usage. - let(:facts) { { - :caller_module_name => 'spec', - :osfamily => 'RedHat', - :staging_http_get => 'curl', - :puppetversion => Puppet.version, - } } + let(:facts) {{ + :osfamily => 'RedHat', + :staging_http_get => 'curl', + :puppetversion => Puppet.version, + }} describe 'when deploying via puppet' do let(:title) { 'sample.tar.gz' } @@ -15,8 +14,8 @@ it { should contain_file('/opt/staging') - should contain_file('/opt/staging/spec/sample.tar.gz') - should_not contain_exec('/opt/staging/spec/sample.tar.gz') + should contain_file('/opt/staging//sample.tar.gz') + should_not contain_exec('/opt/staging//sample.tar.gz') } end @@ -29,7 +28,7 @@ it { should contain_file('/opt/staging') should contain_file('/usr/local/sample.tar.gz') - should_not contain_exec('/opt/staging/spec/sample.tar.gz') + should_not contain_exec('/opt/staging//sample.tar.gz') } end @@ -43,7 +42,7 @@ it { should contain_file('/opt/staging') should contain_file('/usr/local/sample.tar.gz') - should_not contain_exec('/opt/staging/spec/sample.tar.gz') + should_not contain_exec('/opt/staging//sample.tar.gz') } end @@ -53,12 +52,12 @@ it { should contain_file('/opt/staging') - should contain_exec('/opt/staging/spec/sample.tar.gz').with( { - :command => 'curl -f -L -o /opt/staging/spec/sample.tar.gz http://webserver/sample.tar.gz', + should contain_exec('/opt/staging//sample.tar.gz').with( { + :command => 'curl -f -L -o /opt/staging//sample.tar.gz http://webserver/sample.tar.gz', :path => '/usr/local/bin:/usr/bin:/bin', :environment => nil, - :cwd => '/opt/staging/spec', - :creates => '/opt/staging/spec/sample.tar.gz', + :cwd => '/opt/staging/', + :creates => '/opt/staging//sample.tar.gz', :logoutput => 'on_failure', }) } @@ -73,12 +72,12 @@ it { should contain_file('/opt/staging') - should contain_exec('/opt/staging/spec/sample.tar.gz').with( { - :command => 'curl -b -f -L -o /opt/staging/spec/sample.tar.gz http://webserver/sample.tar.gz', + should contain_exec('/opt/staging//sample.tar.gz').with( { + :command => 'curl -b -f -L -o /opt/staging//sample.tar.gz http://webserver/sample.tar.gz', :path => '/usr/local/bin:/usr/bin:/bin', :environment => nil, - :cwd => '/opt/staging/spec', - :creates => '/opt/staging/spec/sample.tar.gz', + :cwd => '/opt/staging/', + :creates => '/opt/staging//sample.tar.gz', :logoutput => 'on_failure', }) } @@ -110,12 +109,12 @@ let(:params) { { :source => 'https://webserver/sample.tar.gz' } } it { should contain_file('/opt/staging') } - it { should contain_exec('/opt/staging/spec/sample.tar.gz').with( { - :command => 'curl -f -L -o /opt/staging/spec/sample.tar.gz https://webserver/sample.tar.gz', + it { should contain_exec('/opt/staging//sample.tar.gz').with( { + :command => 'curl -f -L -o /opt/staging//sample.tar.gz https://webserver/sample.tar.gz', :path => '/usr/local/bin:/usr/bin:/bin', :environment => nil, - :cwd => '/opt/staging/spec', - :creates => '/opt/staging/spec/sample.tar.gz', + :cwd => '/opt/staging/', + :creates => '/opt/staging//sample.tar.gz', :logoutput => 'on_failure', }) } end @@ -129,12 +128,12 @@ it { should contain_file('/opt/staging') - should contain_exec('/opt/staging/spec/sample.tar.gz').with( { - :command => 'curl -f -L -o /opt/staging/spec/sample.tar.gz -u puppet:puppet https://webserver/sample.tar.gz', + should contain_exec('/opt/staging//sample.tar.gz').with( { + :command => 'curl -f -L -o /opt/staging//sample.tar.gz -u puppet:puppet https://webserver/sample.tar.gz', :path => '/usr/local/bin:/usr/bin:/bin', :environment => nil, - :cwd => '/opt/staging/spec', - :creates => '/opt/staging/spec/sample.tar.gz', + :cwd => '/opt/staging/', + :creates => '/opt/staging//sample.tar.gz', :logoutput => 'on_failure', }) } @@ -146,12 +145,12 @@ it { should contain_file('/opt/staging') - should contain_exec('/opt/staging/spec/sample.tar.gz').with( { - :command => 'curl -o /opt/staging/spec/sample.tar.gz ftp://webserver/sample.tar.gz', + should contain_exec('/opt/staging//sample.tar.gz').with( { + :command => 'curl -o /opt/staging//sample.tar.gz ftp://webserver/sample.tar.gz', :path => '/usr/local/bin:/usr/bin:/bin', :environment => nil, - :cwd => '/opt/staging/spec', - :creates => '/opt/staging/spec/sample.tar.gz', + :cwd => '/opt/staging/', + :creates => '/opt/staging//sample.tar.gz', :logoutput => 'on_failure', }) } @@ -166,12 +165,12 @@ it { should contain_file('/opt/staging') - should contain_exec('/opt/staging/spec/sample.tar.gz').with( { - :command => 'curl -o /opt/staging/spec/sample.tar.gz -u puppet:puppet ftp://webserver/sample.tar.gz', + should contain_exec('/opt/staging//sample.tar.gz').with( { + :command => 'curl -o /opt/staging//sample.tar.gz -u puppet:puppet ftp://webserver/sample.tar.gz', :path => '/usr/local/bin:/usr/bin:/bin', :environment => nil, - :cwd => '/opt/staging/spec', - :creates => '/opt/staging/spec/sample.tar.gz', + :cwd => '/opt/staging/', + :creates => '/opt/staging//sample.tar.gz', :logoutput => 'on_failure', }) }