parent
01807c26a7
commit
645a2ec380
|
@ -12,6 +12,7 @@
|
||||||
# Requires:
|
# Requires:
|
||||||
#
|
#
|
||||||
# mysql::database::create
|
# mysql::database::create
|
||||||
|
# grep
|
||||||
#
|
#
|
||||||
# Sample Usage:
|
# Sample Usage:
|
||||||
#
|
#
|
||||||
|
@ -23,6 +24,8 @@
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
define mysql::database::populate ($username, $password, $privileges, $schemafile) {
|
define mysql::database::populate ($username, $password, $privileges, $schemafile) {
|
||||||
|
include grep
|
||||||
|
|
||||||
Exec { path => '/usr/bin' }
|
Exec { path => '/usr/bin' }
|
||||||
|
|
||||||
mysql::database::create { $name:
|
mysql::database::create { $name:
|
||||||
|
@ -34,6 +37,9 @@ define mysql::database::populate ($username, $password, $privileges, $schemafile
|
||||||
exec { "populate-${name}-mysql-db":
|
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 *$'",
|
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}",
|
command => "mysql -uroot ${name} < ${schemafile}",
|
||||||
require => Mysql::Database::Create[$name],
|
require => [
|
||||||
|
Mysql::Database::Create[$name],
|
||||||
|
Class['grep']
|
||||||
|
],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue