diff --git a/manifests/repo.pp b/manifests/repo.pp index c1f4642..a95c76f 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -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") } } } diff --git a/manifests/repo/yum_postgresql_org.pp b/manifests/repo/yum_postgresql_org.pp index 43e633e..9cdfd4a 100644 --- a/manifests/repo/yum_postgresql_org.pp +++ b/manifests/repo/yum_postgresql_org.pp @@ -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, diff --git a/spec/system/server_spec.rb b/spec/system/server_spec.rb index 91f6c1e..1eb13c8 100644 --- a/spec/system/server_spec.rb +++ b/spec/system/server_spec.rb @@ -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