Load the DB schema as the Icinga 2 DB user so that the tables are owned by the DB user instead of the 'postgres' DB user.

This commit is contained in:
Nick Chappell 2014-07-04 20:32:31 -07:00
parent e0248a653c
commit 42f1429e14

View file

@ -116,8 +116,7 @@ class icinga2::server::install::execs inherits icinga2::server {
command => "/usr/sbin/icinga2-enable-feature ido-mysql; touch /etc/icinga2/mysql_module_loaded.txt",
creates => "/etc/icinga2/mysql_module_loaded.txt",
require => Exec['mysql_schema_load'],
}
}
}
'pgsql': {
@ -125,7 +124,7 @@ class icinga2::server::install::execs inherits icinga2::server {
exec { 'postgres_schema_load':
user => 'root',
path => '/usr/bin:/usr/sbin:/bin/:/sbin',
command => "su postgres -c 'psql -d ${db_name} < ${server_db_schema_path}'; touch /etc/icinga2/postgres_schema_loaded.txt",
command => "su postgres -c 'export PGPASSWORD='${db_password}'; psql -U ${db_user} -h localhost -d ${db_name} < ${server_db_schema_path}'; export PGPASSWORD=''; touch /etc/icinga2/postgres_schema_loaded.txt",
creates => "/etc/icinga2/postgres_schema_loaded.txt",
require => Class['icinga2::server::install::packages'],
}