Merge pull request #375 from hunner/fix_lucid

Add class apt for manage_package_repo => true
This commit is contained in:
Hunter Haugen 2014-02-28 17:41:34 -08:00
commit f1e19554fd
3 changed files with 27 additions and 16 deletions

View file

@ -2,12 +2,13 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org"
group :development, :test do
gem 'rake'
gem 'pry', :require => false
gem 'puppetlabs_spec_helper', :require => false
gem 'rspec-puppet', '< 1.0'
gem 'puppet-lint', '~> 0.3.2'
gem 'beaker', :require => false
gem 'beaker-rspec', :require => false
gem 'serverspec', :require => false
gem 'beaker', :require => false
gem 'beaker-rspec', :require => false
gem 'serverspec', :require => false
end
if puppetversion = ENV['PUPPET_GEM_VERSION']

View file

@ -54,6 +54,15 @@ describe 'server without defaults:', :unless => UNSUPPORTED_PLATFORMS.include?(f
after :all do
psql('--command="drop database postgresql_test_db" postgres', 'postgres')
pp = <<-EOS.unindent
if $::osfamily == 'Debian' {
class { 'apt': }
# XXX Need to purge postgresql-common after uninstalling 9.3 because
# it leaves the init script behind. Poor packaging.
package { 'postgresql-common':
ensure => purged,
require => Class['postgresql::server'],
}
}
class { 'postgresql::globals':
ensure => absent,
manage_package_repo => true,
@ -63,11 +72,14 @@ describe 'server without defaults:', :unless => UNSUPPORTED_PLATFORMS.include?(f
ensure => absent,
}
EOS
apply_manifest(pp, :catch_failures => true)
expect(apply_manifest(pp, :catch_failures => true).stderr).to eq('')
end
it 'perform installation and create a db' do
pp = <<-EOS.unindent
if $::osfamily == 'Debian' {
class { 'apt': }
}
class { "postgresql::globals":
version => "9.3",
manage_package_repo => true,
@ -85,7 +97,7 @@ describe 'server without defaults:', :unless => UNSUPPORTED_PLATFORMS.include?(f
}
EOS
apply_manifest(pp, :catch_failures => true)
expect(apply_manifest(pp, :catch_failures => true).stderr).to eq('')
apply_manifest(pp, :catch_changes => true)
shell('test -d /tmp/pg_xlogs') do |r|

View file

@ -34,17 +34,14 @@ def psql(psql_cmd, user = 'postgres', exit_codes = [0], &block)
shell("su #{shellescape(user)} -c #{shellescape(psql)}", :acceptable_exit_codes => exit_codes, &block)
end
hosts.each do |host|
if host['platform'] =~ /debian/
on host, 'echo \'export PATH=/var/lib/gems/1.8/bin/:${PATH}\' >> ~/.bashrc'
end
if host.is_pe?
install_pe
else
# Install Puppet
install_package host, 'rubygems'
on host, 'gem install puppet --no-ri --no-rdoc'
on host, "mkdir -p #{host['distmoduledir']}"
unless ENV['RS_PROVISION'] == 'no'
hosts.each do |host|
if host.is_pe?
install_pe
else
install_puppet
on host, "mkdir -p #{host['distmoduledir']}"
end
end
end
@ -62,6 +59,7 @@ RSpec.configure do |c|
# Install module and dependencies
puppet_module_install(:source => proj_root, :module_name => 'postgresql')
hosts.each do |host|
shell("/bin/touch #{default['puppetpath']}/hiera.yaml")
on host, shell('chmod 755 /root')
if fact('osfamily') == 'Debian'
shell("echo \"en_US ISO-8859-1\nen_NG.UTF-8 UTF-8\nen_US.UTF-8 UTF-8\n\" > /etc/locale.gen")