Skip to content

Commit

Permalink
Update staging to a71e7d6261616fdba9f5c9109c4ad41c120d91be
Browse files Browse the repository at this point in the history
a71e7d6261616fdba9f5c9109c4ad41c120d91be Merge pull request redhat-openstack#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 redhat-openstack#66 from csykora/master
d713efc3ab07ab2171fedafc1a814cb3e45031dd Added quotes around source and target for powershell downloads
986834e057c1c134cf8310a605ccdc2c627f1ffd Merge pull request redhat-openstack#65 from csykora/master
c1cd606aa7c38231d476a5cec4ed2cc31c1466f9 Fix for powershell download failing

Change-Id: I01cbcbc55c7b18c2fafb320a1b94560b1780fbbe
  • Loading branch information
xbezdick committed Apr 30, 2015
1 parent d8b2e20 commit ba1776a
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 68 deletions.
2 changes: 1 addition & 1 deletion Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 5 additions & 1 deletion staging/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions staging/manifests/file.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
14 changes: 9 additions & 5 deletions staging/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,35 @@
"operatingsystemrelease": [
"4",
"5",
"6"
"6",
"7"
]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"4",
"5",
"6"
"6",
"7"
]
},
{
"operatingsystem": "OracleLinux",
"operatingsystemrelease": [
"4",
"5",
"6"
"6",
"7"
]
},
{
"operatingsystem": "Scientific",
"operatingsystemrelease": [
"4",
"5",
"6"
"6",
"7"
]
},
{
Expand Down Expand Up @@ -88,7 +92,7 @@
},
{
"name": "puppet",
"version_requirement": ">=2.7.0 <4.0.0"
"version_requirement": ">=2.7.0"
}
],
"name": "nanliu-staging",
Expand Down
37 changes: 21 additions & 16 deletions staging/spec/defines/staging_deploy_spec.rb
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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'
Expand Down
19 changes: 10 additions & 9 deletions staging/spec/defines/staging_extract_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand Down
67 changes: 33 additions & 34 deletions staging/spec/defines/staging_file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@
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' }
let(:params) { { :source => 'puppet:///modules/staging/sample.tar.gz' } }

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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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',
})
}
Expand All @@ -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',
})
}
Expand Down Expand Up @@ -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
Expand All @@ -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',
})
}
Expand All @@ -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',
})
}
Expand All @@ -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',
})
}
Expand Down

0 comments on commit ba1776a

Please sign in to comment.