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