Fix repo removal for testing purposes

Signed-off-by: Ken Barber <ken@bob.sh>
This commit is contained in:
Ken Barber 2013-09-17 22:19:01 +01:00
parent ce94eb348a
commit cd2bc50cdf
3 changed files with 17 additions and 15 deletions

View file

@ -3,22 +3,20 @@ class postgresql::repo (
$ensure = 'present',
$version = undef
) inherits postgresql::params {
if $ensure == 'present' or $ensure == true {
case $::osfamily {
'RedHat', 'Linux': {
if $version == undef {
fail("The parameter 'version' for 'postgresql::repo' is undefined. You must always define it when osfamily == Redhat or Linux")
}
class { 'postgresql::repo::yum_postgresql_org': }
case $::osfamily {
'RedHat', 'Linux': {
if $version == undef {
fail("The parameter 'version' for 'postgresql::repo' is undefined. You must always define it when osfamily == Redhat or Linux")
}
class { 'postgresql::repo::yum_postgresql_org': }
}
'Debian': {
class { 'postgresql::repo::apt_postgresql_org': }
}
'Debian': {
class { 'postgresql::repo::apt_postgresql_org': }
}
default: {
fail("Unsupported managed repository for osfamily: ${::osfamily}, operatingsystem: ${::operatingsystem}, module ${module_name} currently only supports managing repos for osfamily RedHat and Debian")
}
default: {
fail("Unsupported managed repository for osfamily: ${::osfamily}, operatingsystem: ${::operatingsystem}, module ${module_name} currently only supports managing repos for osfamily RedHat and Debian")
}
}
}

View file

@ -29,7 +29,7 @@ class postgresql::repo::yum_postgresql_org inherits postgresql::repo {
Yumrepo['yum.postgresql.org'] -> Package<|tag == 'postgresql'|>
} else {
yumrepo { 'yum.postgresql.org':
ensure => absent,
enabled => absent,
}->
file { $gpg_key_path:
ensure => absent,

View file

@ -82,12 +82,16 @@ describe 'server without defaults:' do
pp = <<-EOS
class { 'postgresql::globals':
version => "9.2",
manage_package_repo => true,
service_status => 'service postgresql-9.2 status',
}
class { 'postgresql::server':
ensure => absent,
}
# Repo removal doesn't work on its own, so we do it here
class { 'postgresql::repo':
ensure => absent,
version => '9.2',
}
EOS
puppet_apply(pp) do |r|
r.exit_code.should_not == 1