From 08d21a388def39876d3fa02f9184f58d10f6054c 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 0a5b404d28..971191f5d5 100644 --- a/manifests/server/role.pp +++ b/manifests/server/role.pp @@ -56,8 +56,14 @@ } 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}", + } } }