From 7c800ae6d972c3f8b914bcffb080a8503f8184b9 Mon Sep 17 00:00:00 2001 From: Lennart Betz Date: Fri, 24 Feb 2017 16:09:49 +0100 Subject: [PATCH] fix #237 wrong dependency in ido modules --- manifests/feature/idomysql.pp | 40 ++++++++++++++++++----------------- manifests/feature/idopgsql.pp | 40 ++++++++++++++++++----------------- 2 files changed, 42 insertions(+), 38 deletions(-) diff --git a/manifests/feature/idomysql.pp b/manifests/feature/idomysql.pp index d1353dbc8..d6747bb1e 100644 --- a/manifests/feature/idomysql.pp +++ b/manifests/feature/idomysql.pp @@ -286,25 +286,6 @@ $attrs_ssl = { enable_ssl => $enable_ssl } } - if $ido_mysql_package { - package { $ido_mysql_package: - ensure => installed, - before => [ - Exec['idomysql-import-schema'], - Icinga2::Feature['ido-mysql'] - ] - } - } - - if $import_schema { - exec { 'idomysql-import-schema': - user => 'root', - path => $::path, - command => "mysql -h '${host}' -u '${user}' -p'${password}' '${database}' < '/usr/share/icinga2-ido-mysql/schema/mysql.sql'", - unless => "mysql -h '${host}' -u '${user}' -p'${password}' '${database}' -Ns -e 'select version from icinga_dbversion'", - } - } - $attrs = { host => $host, port => $port, @@ -322,6 +303,27 @@ } + # install additional package + if $ido_mysql_package { + package { $ido_mysql_package: + ensure => installed, + before => Icinga2::Feature['ido-mysql'], + } + } + + # import db schema + if $import_schema { + if $ido_mysql_package { + Package[$ido_mysql_package] -> Exec['idomysql-import-schema'] + } + exec { 'idomysql-import-schema': + user => 'root', + path => $::path, + command => "mysql -h '${host}' -u '${user}' -p'${password}' '${database}' < '/usr/share/icinga2-ido-mysql/schema/mysql.sql'", + unless => "mysql -h '${host}' -u '${user}' -p'${password}' '${database}' -Ns -e 'select version from icinga_dbversion'", + } + } + # create object icinga2::object { 'icinga2::object::IdoMysqlConnection::ido-mysql': object_name => 'ido-mysql', diff --git a/manifests/feature/idopgsql.pp b/manifests/feature/idopgsql.pp index 356c6f9db..157216691 100644 --- a/manifests/feature/idopgsql.pp +++ b/manifests/feature/idopgsql.pp @@ -109,17 +109,34 @@ if $categories { validate_array($categories) } validate_bool($import_schema) + $attrs = { + host => $host, + port => $port, + user => $user, + password => $password, + database => $database, + table_prefix => $table_prefix, + instance_name => $instance_name, + instance_description => $instance_description, + enable_ha => $enable_ha, + failover_timeout => $failover_timeout, + cleanup => $cleanup, + categories => $categories, + } + + # install additional package if $ido_pgsql_package { package { $ido_pgsql_package: ensure => installed, - before => [ - Exec['idopgsql-import-schema'], - Icinga2::Feature['ido-pgsql'], - ] + before => Icinga2::Feature['ido-pgsql'], } } + # import db schema if $import_schema { + if $ido_pgsql_package { + Package[$ido_pgsql_package] -> Exec['idopgsql-import-schema'] + } exec { 'idopgsql-import-schema': user => 'root', path => $::path, @@ -129,21 +146,6 @@ } } - $attrs = { - host => $host, - port => $port, - user => $user, - password => $password, - database => $database, - table_prefix => $table_prefix, - instance_name => $instance_name, - instance_description => $instance_description, - enable_ha => $enable_ha, - failover_timeout => $failover_timeout, - cleanup => $cleanup, - categories => $categories, - } - # create object icinga2::object { 'icinga2::object::IdoPgsqlConnection::ido-pgsql': object_name => 'ido-pgsql',