Skip to content

Commit

Permalink
fix Icinga#237 wrong dependency in ido modules
Browse files Browse the repository at this point in the history
  • Loading branch information
lbetz committed Feb 24, 2017
1 parent 38edc0a commit 7c800ae
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 38 deletions.
40 changes: 21 additions & 19 deletions manifests/feature/idomysql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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',
Expand Down
40 changes: 21 additions & 19 deletions manifests/feature/idopgsql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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',
Expand Down

0 comments on commit 7c800ae

Please sign in to comment.