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.
This commit is contained in:
Brandon Wamboldt 2013-12-20 13:09:42 -04:00
parent 68e0a6cc03
commit 694c3ffbf7

View file

@ -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}",
}
}
}