Add a - between the su and postgres so that we inherit the Postgres user's environment and don't try to run the command with /root as the working directory.
This commit is contained in:
parent
f9f7cc5ad9
commit
cb477311a9
1 changed files with 1 additions and 1 deletions
|
@ -134,7 +134,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 '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",
|
||||
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'],
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue