File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 1
1
# @summary Define for conveniently creating a role, database and assigning the correctpermissions.
2
2
#
3
- # @param user User to create and assign access to the database upon creation. Mandatory.
4
- # @param password Required Sets the password for the created user.
3
+ # @param user User to assign access to the database upon creation (will be created if not defined elsewhere) . Mandatory.
4
+ # @param password Sets the password for the created user (if a user is created) .
5
5
# @param comment Defines a comment to be stored about the database using the PostgreSQL COMMENT command.
6
6
# @param dbname Sets the name of the database to be created.
7
7
# @param encoding Overrides the character set during creation of the database.
13
13
# @param owner Sets a user as the owner of the database.
14
14
define postgresql::server::db (
15
15
$user ,
16
- Variant[String, Sensitive[String]] $password ,
16
+ Optional[ Variant[String, Sensitive[String]]] $password = undef ,
17
17
$comment = undef ,
18
18
$dbname = $title,
19
19
$encoding = $postgresql::server::encoding,
37
37
}
38
38
39
39
if ! defined (Postgresql::Server::Role[$user ]) {
40
+ if ! $password {
41
+ fail(' Please provide password or create a user: if you rely on postgresql::server::db to create a user, a password is needed' )
42
+ }
40
43
postgresql::server::role { $user:
41
44
password_hash => $password ,
42
45
before => Postgresql::Server::Database[$dbname ],
You can’t perform that action at this time.
0 commit comments