From 694c3ffbf7e0328a27f708a942e433241279e95c Mon Sep 17 00:00:00 2001 From: Brandon Wamboldt Date: Fri, 20 Dec 2013 13:09:42 -0400 Subject: [PATCH] Fix NOREPLICATION option for Postgres 9.1 Fixing a bug when using this module with Postgresql 9.1 that causes alter role statements to execute during every apply. --- manifests/server/role.pp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/manifests/server/role.pp b/manifests/server/role.pp index 0a5b404..971191f 100644 --- a/manifests/server/role.pp +++ b/manifests/server/role.pp @@ -56,8 +56,14 @@ define postgresql::server::role( } if(versioncmp($version, '9.1') >= 0) { - postgresql_psql {"ALTER ROLE \"${username}\" ${replication_sql}": - unless => "SELECT rolname FROM pg_roles WHERE rolname='${username}' and rolreplication=${replication}", + if $replication_sql == '' { + postgresql_psql {"ALTER ROLE \"${username}\" NOREPLICATION": + unless => "SELECT rolname FROM pg_roles WHERE rolname='${username}' and rolreplication=${replication}", + } + } else { + postgresql_psql {"ALTER ROLE \"${username}\" ${replication_sql}": + unless => "SELECT rolname FROM pg_roles WHERE rolname='${username}' and rolreplication=${replication}", + } } }