commit b22f96ffd533f7920027d6f91b8cebcddf8bcbf9
Author: Ewoud Kohl van Wijngaarden <e.kohlvanwijngaarden@oxilion.nl>
Date:   Thu Oct 31 14:58:32 2013 +0100

    Work with puppetlabs-postgresql version 3+
    
    This drops support for puppet 2.6.

diff --git a/.fixtures.yml b/.fixtures.yml
index 575d997..7cfcfeb 100644
--- a/.fixtures.yml
+++ b/.fixtures.yml
@@ -5,14 +5,11 @@ fixtures:
       repo:           'git://github.com/ripienaar/puppet-concat'
       ref:            '04356974f72b90a1d0f57346a00e95a717924e43'
     concat_native:    'git://github.com/theforeman/puppet-concat'
-    create_resources: 'git://github.com/puppetlabs/puppetlabs-create_resources'
     mysql:
       repo:           'git://github.com/puppetlabs/puppetlabs-mysql'
       ref:            '52fb70ebdeb74f66bedc54196c0884c2b84699f3'
     passenger:        'git://github.com/theforeman/puppet-passenger'
-    postgresql:
-      repo:           'git://github.com/puppetlabs/puppetlabs-postgresql'
-      ref:            'efb5daae5dc66da9e6ebfe21d1f09fb763e9a0f8'
+    postgresql:       'git://github.com/puppetlabs/puppetlabs-postgresql'
     puppet:           'git://github.com/theforeman/puppet-puppet'
     stdlib:           'git://github.com/puppetlabs/puppetlabs-stdlib'
 
diff --git a/.travis.yml b/.travis.yml
index 04bce52..932e0e6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,17 +3,11 @@ rvm:
   - 1.9.3
   - 2.0.0
 env:
-  - PUPPET_VERSION=2.6.0
   - PUPPET_VERSION=2.7.0
   - PUPPET_VERSION=3.2.0
   - PUPPET_VERSION=3.3
 matrix:
   exclude:
-    # No support for Ruby 1.9 before Puppet 2.7
-    - rvm: 1.9.3
-      env: PUPPET_VERSION=2.6.0
-    # No support VERSIONfor Ruby 2.0 before Puppet 3.2
-    - rvm: 2.0.0
-      env: PUPPET_VERSION=2.6.0
+    # No support for Ruby 2.0 before Puppet 3.2
     - rvm: 2.0.0
       env: PUPPET_VERSION=2.7.0
diff --git a/Modulefile b/Modulefile
index df2e367..eb5a790 100644
--- a/Modulefile
+++ b/Modulefile
@@ -11,5 +11,5 @@ dependency 'theforeman/apache', '>= 1.3.0'
 dependency 'theforeman/concat_native', '>= 1.3.0'
 dependency 'theforeman/passenger', '>= 1.3.0'
 
-dependency 'puppetlabs/postgresql', '>= 2.2.0'
+dependency 'puppetlabs/postgresql', '>= 3.0.0'
 dependency 'puppetlabs/stdlib'
diff --git a/manifests/database/postgresql.pp b/manifests/database/postgresql.pp
index 2f7e372..b33481b 100644
--- a/manifests/database/postgresql.pp
+++ b/manifests/database/postgresql.pp
@@ -15,31 +15,12 @@ class foreman::database::postgresql {
     cwd => '/',
   }
 
-  include postgresql::client, postgresql::server, postgresql::params
-
-  if ! defined(Postgresql::Database_user[$foreman::db_username]) {
-    postgresql::database_user { $foreman::db_username:
-      password_hash   => $password,
-      require         => Class['postgresql::server'],
-      before          => Postgresql::Database[$dbname],
-    }
-  }
-
-  $grant = 'ALL'
-  # TODO copied from puppetlabs-postgresql 2.3.0 manifests/db.pp
-  # should be removed by db once they expose owner parameter
-  postgresql::database { $dbname:
-    charset     => $postgresql::params::charset,
-    tablespace  => undef,
-    require     => Class['postgresql::server'],
-    locale      => $postgresql::params::locale,
-    owner       => $foreman::db_username,
+  include postgresql::client, postgresql::server
+  postgresql::server::db { $dbname:
+    user     => $foreman::db_username,
+    password => $password,
+    owner    => $foreman::db_username,
   }
 
-  postgresql::database_grant { "GRANT ${$foreman::db_username} - ${grant} - ${dbname}":
-    privilege => $grant,
-    db        => $dbname,
-    role      => $foreman::db_username,
-    require   => [Postgresql::Database[$dbname], Postgresql::Database_user[$foreman::db_username]],
-  }
+  Postgresql::Server::Role[$foreman::db_username] -> Postgresql::Server::Database[$dbname]
 }
diff --git a/spec/classes/foreman_config_passenger_spec.rb b/spec/classes/foreman_config_passenger_spec.rb
index 361adf0..c3bb934 100644
--- a/spec/classes/foreman_config_passenger_spec.rb
+++ b/spec/classes/foreman_config_passenger_spec.rb
@@ -4,18 +4,18 @@ require 'spec_helper'
 describe 'foreman::config::passenger' do
   let :default_facts do
     {
-      :concat_basedir           => '/tmp',
-      :interfaces               => 'lo',
-      :ipaddress_lo             => '127.0.0.1',
-      :postgres_default_version => '8.4',
+      :concat_basedir => '/tmp',
+      :interfaces     => 'lo',
+      :ipaddress_lo   => '127.0.0.1',
     }
   end
 
   context 'on redhat' do
     let :facts do
       default_facts.merge({
-        :operatingsystem => 'RedHat',
-        :osfamily        => 'RedHat',
+        :operatingsystem        => 'RedHat',
+        :operatingsystemrelease => '6.4',
+        :osfamily               => 'RedHat',
       })
     end
 
diff --git a/spec/classes/foreman_config_spec.rb b/spec/classes/foreman_config_spec.rb
index d199b33..f42209e 100644
--- a/spec/classes/foreman_config_spec.rb
+++ b/spec/classes/foreman_config_spec.rb
@@ -4,17 +4,17 @@ require 'spec_helper'
 describe 'foreman::config' do
   let :default_facts do
     {
-      :concat_basedir           => '/tmp',
-      :interfaces               => '',
-      :postgres_default_version => '8.4',
+      :concat_basedir => '/tmp',
+      :interfaces     => '',
     }
   end
 
   context 'on redhat' do
     let :facts do
       default_facts.merge({
-        :operatingsystem => 'RedHat',
-        :osfamily        => 'RedHat',
+        :operatingsystem        => 'RedHat',
+        :operatingsystemrelease => '6.4',
+        :osfamily               => 'RedHat',
       })
     end
 
@@ -166,8 +166,9 @@ describe 'foreman::config' do
   context 'on debian' do
     let :facts do
       default_facts.merge({
-        :operatingsystem => 'Debian',
-        :osfamily        => 'Debian',
+        :operatingsystem        => 'Debian',
+        :operatingsystemrelease => 'wheezy',
+        :osfamily               => 'Debian',
       })
     end
 
diff --git a/spec/classes/foreman_database_spec.rb b/spec/classes/foreman_database_spec.rb
index cc55b96..cf66931 100644
--- a/spec/classes/foreman_database_spec.rb
+++ b/spec/classes/foreman_database_spec.rb
@@ -3,17 +3,17 @@ require 'spec_helper'
 describe 'foreman::install' do
   let :default_facts do
     {
-      :concat_basedir           => '/tmp',
-      :interfaces               => '',
-      :postgres_default_version => '8.4',
+      :concat_basedir => '/tmp',
+      :interfaces     => '',
     }
   end
 
   context 'RedHat' do
     let :facts do
       default_facts.merge({
-        :operatingsystem => 'RedHat',
-        :osfamily        => 'RedHat',
+        :operatingsystem        => 'RedHat',
+        :operatingsystemrelease => '6.4',
+        :osfamily               => 'RedHat',
       })
     end
 
@@ -32,8 +32,9 @@ describe 'foreman::install' do
   context 'on debian' do
     let :facts do
       default_facts.merge({
-        :operatingsystem => 'Debian',
-        :osfamily        => 'Debian',
+        :operatingsystem        => 'Debian',
+        :operatingsystemrelease => 'wheezy',
+        :osfamily               => 'Debian',
       })
     end
 
diff --git a/spec/classes/foreman_install_spec.rb b/spec/classes/foreman_install_spec.rb
index 83cbc36..af96685 100644
--- a/spec/classes/foreman_install_spec.rb
+++ b/spec/classes/foreman_install_spec.rb
@@ -3,17 +3,17 @@ require 'spec_helper'
 describe 'foreman::install' do
   let :default_facts do
     {
-      :concat_basedir           => '/tmp',
-      :interfaces               => '',
-      :postgres_default_version => '8.4',
+      :concat_basedir => '/tmp',
+      :interfaces     => '',
     }
   end
 
   context 'RedHat' do
     let :facts do
       default_facts.merge({
-        :operatingsystem => 'RedHat',
-        :osfamily        => 'RedHat',
+        :operatingsystem        => 'RedHat',
+        :operatingsystemrelease => '6.4',
+        :osfamily               => 'RedHat',
       })
     end
 
@@ -90,9 +90,10 @@ describe 'foreman::install' do
     context 'with SELinux enabled' do
       let :facts do
         default_facts.merge({
-          :operatingsystem => 'RedHat',
-          :osfamily        => 'RedHat',
-          :selinux         => 'true',
+          :operatingsystem        => 'RedHat',
+          :operatingsystemrelease => '6.4',
+          :osfamily               => 'RedHat',
+          :selinux                => 'true',
         })
       end
 
@@ -125,9 +126,10 @@ describe 'foreman::install' do
     context 'with SELinux disabled' do
       let :facts do
         default_facts.merge({
-          :operatingsystem => 'RedHat',
-          :osfamily        => 'RedHat',
-          :selinux         => 'false',
+          :operatingsystem        => 'RedHat',
+          :operatingsystemrelease => '6.4',
+          :osfamily               => 'RedHat',
+          :selinux                => 'false',
         })
       end
 
@@ -162,8 +164,9 @@ describe 'foreman::install' do
   context 'on debian' do
     let :facts do
       default_facts.merge({
-        :operatingsystem => 'Debian',
-        :osfamily        => 'Debian',
+        :operatingsystem        => 'Debian',
+        :operatingsystemrelease => 'wheezy',
+        :osfamily               => 'Debian',
       })
     end
 
diff --git a/spec/classes/foreman_plugin_puppetdb_spec.rb b/spec/classes/foreman_plugin_puppetdb_spec.rb
index f187a66..5040ea3 100644
--- a/spec/classes/foreman_plugin_puppetdb_spec.rb
+++ b/spec/classes/foreman_plugin_puppetdb_spec.rb
@@ -9,4 +9,3 @@ describe 'foreman::plugin::puppetdb' do
     should contain_foreman__plugin('puppetdb').with_package('ruby-puppetdb_foreman')
   end
 end
-
diff --git a/spec/classes/foreman_service_spec.rb b/spec/classes/foreman_service_spec.rb
index cea854f..8fefba0 100644
--- a/spec/classes/foreman_service_spec.rb
+++ b/spec/classes/foreman_service_spec.rb
@@ -3,17 +3,17 @@ require 'spec_helper'
 describe 'foreman::install' do
   let :default_facts do
     {
-      :concat_basedir           => '/tmp',
-      :interfaces               => '',
-      :postgres_default_version => '8.4',
+      :concat_basedir => '/tmp',
+      :interfaces     => '',
     }
   end
 
   context 'RedHat' do
     let :facts do
       default_facts.merge({
-        :operatingsystem => 'RedHat',
-        :osfamily        => 'RedHat',
+        :operatingsystem        => 'RedHat',
+        :operatingsystemrelease => '6.4',
+        :osfamily               => 'RedHat',
       })
     end
 
diff --git a/spec/classes/foreman_spec.rb b/spec/classes/foreman_spec.rb
index 6bed659..151e4e4 100644
--- a/spec/classes/foreman_spec.rb
+++ b/spec/classes/foreman_spec.rb
@@ -4,17 +4,17 @@ require 'spec_helper'
 describe 'foreman' do
   let :default_facts do
     {
-      :concat_basedir           => '/tmp',
-      :interfaces               => '',
-      :postgres_default_version => '8.4',
+      :concat_basedir => '/tmp',
+      :interfaces     => '',
     }
   end
 
   context 'on redhat' do
     let :facts do
       default_facts.merge({
-        :operatingsystem => 'RedHat',
-        :osfamily        => 'RedHat',
+        :operatingsystem        => 'RedHat',
+        :operatingsystemrelease => '6.4',
+        :osfamily               => 'RedHat',
       })
     end
 
@@ -27,8 +27,9 @@ describe 'foreman' do
   context 'on debian' do
     let :facts do
       default_facts.merge({
-        :operatingsystem => 'Debian',
-        :osfamily        => 'Debian',
+        :operatingsystem        => 'Debian',
+        :operatingsystemrelease => 'wheezy',
+        :osfamily               => 'Debian',
       })
     end
 
diff --git a/spec/defines/foreman_plugin_spec.rb b/spec/defines/foreman_plugin_spec.rb
index 6f08bf3..e5e9fdf 100644
--- a/spec/defines/foreman_plugin_spec.rb
+++ b/spec/defines/foreman_plugin_spec.rb
@@ -9,9 +9,10 @@ describe 'foreman::plugin' do
     end
 
     let :facts do {
-      :concat_basedir           => '/nonexistant',
-      :osfamily                 => 'RedHat',
-      :postgres_default_version => '8.4',
+      :concat_basedir         => '/nonexistant',
+      :operatingsystem        => 'RedHat',
+      :operatingsystemrelease => '6.4',
+      :osfamily               => 'RedHat',
     } end
 
     it 'should install the correct package with notify' do
diff --git a/spec/defines/foreman_rake_spec.rb b/spec/defines/foreman_rake_spec.rb
index 4e80688..07d0057 100644
--- a/spec/defines/foreman_rake_spec.rb
+++ b/spec/defines/foreman_rake_spec.rb
@@ -3,9 +3,8 @@ require 'spec_helper'
 describe 'foreman::rake' do
   let :default_facts do
     {
-      :concat_basedir           => '/tmp',
-      :interfaces               => '',
-      :postgres_default_version => '8.4',
+      :concat_basedir => '/tmp',
+      :interfaces     => '',
     }
   end
 
