From 0cc89ec9fd3f3556e48ba82abc545173a616a6be Mon Sep 17 00:00:00 2001 From: Jan Collijs Date: Mon, 4 Jan 2016 15:05:38 +0100 Subject: [PATCH] Bugfix: only create db scheme once when tables are not yet deployed --- manifests/initialize.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/initialize.pp b/manifests/initialize.pp index f9854b8..7374557 100644 --- a/manifests/initialize.pp +++ b/manifests/initialize.pp @@ -9,8 +9,8 @@ class icingaweb2::initialize { case $::icingaweb2::web_db { 'mysql': { exec { 'create db scheme': - command => "mysql -u ${::icingaweb2::web_db_user} -p${::icingaweb2::web_db_pass} ${::icingaweb2::web_db_name} < /usr/share/doc/icingaweb2/schema/mysql.schema.sql", - onlyif => 'test -f /root/.my.cnf', + command => "mysql --defaults-file='/root/.my.cnf' ${::icingaweb2::web_db_name} < /usr/share/doc/icingaweb2/schema/mysql.schema.sql", + unless => "mysql --defaults-file='/root/.my.cnf' ${::icingaweb2::web_db_name} -e \"SELECT 1 FROM icingaweb_user LIMIT 1;\"", notify => Exec['create web user'] }