[icinga-checkins] icinga.org: icinga-vagrant/master: MySQL: Ensure to run exec with root $HOME/.my.cnf environment

git at icinga.org git at icinga.org
Wed Jul 27 21:26:33 CEST 2016


Module: icinga-vagrant
Branch: master
Commit: ae93c5c0ddeac5bce90ca0e818a35bcf3a07d1c6
URL:    https://git.icinga.org/?p=icinga-vagrant.git;a=commit;h=ae93c5c0ddeac5bce90ca0e818a35bcf3a07d1c6

Author: Michael Friedrich <michael.friedrich at netways.de>
Date:   Wed Jul 27 21:24:36 2016 +0200

MySQL: Ensure to run exec with root $HOME/.my.cnf environment

---

 icinga2x/manifests/default.pp     |    2 ++
 modules/icinga2/manifests/init.pp |    8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/icinga2x/manifests/default.pp b/icinga2x/manifests/default.pp
index 023199b..0a6eb4e 100644
--- a/icinga2x/manifests/default.pp
+++ b/icinga2x/manifests/default.pp
@@ -382,6 +382,8 @@ exec { 'create-mysql-icingaweb2-director-db':
   path        => '/bin:/usr/bin:/sbin:/usr/sbin',
   unless      => 'mysql -udirector -pdirector director',
   command     => 'mysql -uroot -e "CREATE DATABASE director; GRANT ALL ON director.* TO director at localhost IDENTIFIED BY \'director\';"',
+  user        => 'root',
+  environment => [ "HOME=/root" ],
   require     => Service['mariadb']
 }->
 exec { 'Icinga Director DB migration':
diff --git a/modules/icinga2/manifests/init.pp b/modules/icinga2/manifests/init.pp
index 440ce5f..06305f5 100644
--- a/modules/icinga2/manifests/init.pp
+++ b/modules/icinga2/manifests/init.pp
@@ -81,6 +81,8 @@ class icinga2_ido_mysql (
     path => '/bin:/usr/bin:/sbin:/usr/sbin',
     unless => "mysql -u$ido_db_user -p$ido_db_pass $ido_db_name",
     command => "mysql -uroot -e \"CREATE DATABASE $ido_db_name ; GRANT ALL ON $ido_db_name.* TO $ido_db_user at localhost IDENTIFIED BY \'$ido_db_pass\';\"",
+    user => 'root',
+    environment => [ "HOME=/root" ],
     require => Class['mysql::server']
   }
 
@@ -88,6 +90,8 @@ class icinga2_ido_mysql (
     path => '/bin:/usr/bin:/sbin:/usr/sbin',
     unless => "mysql -u$ido_db_user -p$ido_db_pass $ido_db_name -e \"SELECT * FROM icinga_dbversion;\" &> /dev/null",
     command => "mysql -u$ido_db_user -p$ido_db_pass $ido_db_name < $ido_db_schema",
+    user => 'root',
+    environment => [ "HOME=/root" ],
     require => [ Package['icinga2-ido-mysql'], Exec['create-mysql-icinga2-ido-db'] ]
   }
 
@@ -120,6 +124,8 @@ class icinga2_ido_pgsql (
     command => "sudo -u postgres psql -c \"CREATE ROLE $ido_db_user WITH LOGIN PASSWORD \'$ido_db_pass\';\" && \
                 sudo -u postgres createdb -O $ido_db_name -E UTF8 $ido_db_name && \
                 sudo -u postgres createlang plpgsql $ido_db_name",
+    user => 'root',
+    environment => [ "HOME=/root" ],
     require => Service['postgresql']
   }
 
@@ -128,6 +134,8 @@ class icinga2_ido_pgsql (
     environment => ["PGPASSWORD=$ido_db_pass"],
     unless => "psql -U $ido_db_user -d $ido_db_name -c \"SELECT * FROM icinga_dbversion;\" &> /dev/null",
     command => "psql -U $ido_db_user -d $ido_db_name < $ido_db_schema",
+    user => 'root',
+    environment => [ "HOME=/root" ],
     require => [ Package['icinga2-ido-pgsql'], Exec['create-pgsql-icinga2-ido-db'] ]
   }
 



More information about the icinga-checkins mailing list