Skip to content

Commit

Permalink
fix service dependency issue
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonHoenscheid committed Apr 24, 2024
1 parent 79d8430 commit e51f3d9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
3 changes: 3 additions & 0 deletions manifests/server/database_grant.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# @param psql_group Overrides the default postgres user group to be used for related files in the file system.
# @param connect_settings Specifies a hash of environment variables used when connecting to a remote server.
# @param port Port to use when connecting.
# @param instance The name of the Postgresql database instance.
define postgresql::server::database_grant (
Enum['ALL', 'CREATE', 'CONNECT', 'TEMPORARY', 'TEMP', 'all', 'create', 'connect', 'temporary', 'temp'] $privilege,
String[1] $db,
Expand All @@ -19,6 +20,7 @@
Hash $connect_settings = $postgresql::server::default_connect_settings,
String[1] $psql_group = $postgresql::server::group,
Stdlib::Port $port = $postgresql::server::port,
String[1] $instance = 'main',
) {
postgresql::server::grant { "database:${name}":
ensure => $ensure,
Expand All @@ -32,5 +34,6 @@
group => $psql_group,
port => $port,
connect_settings => $connect_settings,
instance => $instance,
}
}
3 changes: 3 additions & 0 deletions manifests/server/db.pp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
port => $port,
user => $psql_user,
group => $psql_group,
instance => $instance,
}
}

Expand All @@ -54,6 +55,7 @@
psql_user => $psql_user,
psql_group => $psql_group,
before => Postgresql::Server::Database[$dbname],
instance => $instance,
}
}

Expand All @@ -65,6 +67,7 @@
port => $port,
psql_user => $psql_user,
psql_group => $psql_group,
instance => $instance,
} -> Postgresql_conn_validator<| db_name == $dbname |>
}

Expand Down
3 changes: 3 additions & 0 deletions manifests/server/table_grant.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# @param psql_user Specifies the OS user for running psql.
# @param connect_settings Specifies a hash of environment variables used when connecting to a remote server.
# @param onlyif_exists Create grant only if it doesn't exist.
# @param instance The name of the Postgresql database instance.
define postgresql::server::table_grant (
Enum['ALL', 'SELECT', 'INSERT', 'UPDATE', 'DELETE', 'TRUNCATE', 'REFERENCES', 'TRIGGER', 'all', 'select', 'insert', 'update', 'delete',
'truncate', 'references', 'trigger'] $privilege,
Expand All @@ -24,6 +25,7 @@
Optional[String[1]] $psql_user = undef,
Optional[Hash] $connect_settings = undef,
Boolean $onlyif_exists = false,
String[1] $instance = 'main',
) {
postgresql::server::grant { "table:${name}":
ensure => $ensure,
Expand All @@ -37,5 +39,6 @@
psql_user => $psql_user,
onlyif_exists => $onlyif_exists,
connect_settings => $connect_settings,
instance => $instance,
}
}
11 changes: 7 additions & 4 deletions manifests/server_instance.pp
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,11 @@
}
$databases.each |$database, $database_details| {
postgresql::server::database { $database:
* => $database_details,
user => $instance_user,
group => $instance_group,
port => $config_settings['port'],
* => $database_details,
user => $instance_user,
group => $instance_group,
port => $config_settings['port'],
instance => $instance_name,
}
}
$database_grants.each |$db_grant_title, $dbgrants| {
Expand All @@ -125,13 +126,15 @@
psql_user => $instance_user,
psql_group => $instance_group,
port => $config_settings['port'],
instance => $instance_name,
}
}
$table_grants.each |$table_grant_title, $tgrants| {
postgresql::server::table_grant { $table_grant_title:
* => $tgrants,
psql_user => $instance_user,
port => $config_settings['port'],
instance => $instance_name,
}
}
}

0 comments on commit e51f3d9

Please sign in to comment.