mysql::database::populate: require module `grep'

refs #6842
This commit is contained in:
Alexander Klimov 2014-09-10 10:20:22 +02:00
parent 01807c26a7
commit 645a2ec380
1 changed files with 7 additions and 1 deletions

View File

@ -12,6 +12,7 @@
# Requires:
#
# mysql::database::create
# grep
#
# Sample Usage:
#
@ -23,6 +24,8 @@
# }
#
define mysql::database::populate ($username, $password, $privileges, $schemafile) {
include grep
Exec { path => '/usr/bin' }
mysql::database::create { $name:
@ -34,6 +37,9 @@ define mysql::database::populate ($username, $password, $privileges, $schemafile
exec { "populate-${name}-mysql-db":
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],
require => [
Mysql::Database::Create[$name],
Class['grep']
],
}
}