mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 16:24:04 +02:00
pgsql::database::populate: populate the DB only if it's empty
refs #6842
This commit is contained in:
parent
4484a3117b
commit
be7bae8cd6
@ -29,7 +29,7 @@ define pgsql::database::populate ($username, $password, $schemafile) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
exec { "populate-${name}-pgsql-db":
|
exec { "populate-${name}-pgsql-db":
|
||||||
unless => "psql -U ${username} -d ${name} -c \"SELECT * FROM icinga_dbversion;\" &> /dev/null",
|
onlyif => "psql -U ${username} -d ${name} -c \"SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '${name}';\" 2>/dev/null |grep -qEe '^ *0 *$'",
|
||||||
command => "sudo -u postgres psql -U ${username} -d ${name} < ${schemafile}",
|
command => "sudo -u postgres psql -U ${username} -d ${name} < ${schemafile}",
|
||||||
require => Pgsql::Database::Create[$name],
|
require => Pgsql::Database::Create[$name],
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user