Moved the logic to determine the path of the DB schema to the main icinga2::server class.
This commit is contained in:
parent
87318a1722
commit
d750ebd738
2 changed files with 34 additions and 13 deletions
|
@ -34,12 +34,6 @@ class icinga2::params {
|
||||||
$package_provider = 'yum'
|
$package_provider = 'yum'
|
||||||
#Icinga 2 server package
|
#Icinga 2 server package
|
||||||
$icinga2_server_package = 'icinga2'
|
$icinga2_server_package = 'icinga2'
|
||||||
|
|
||||||
#Pick set the right path where we can find the DB schema
|
|
||||||
case $server_db_type {
|
|
||||||
'mysql': { $server_db_schema_path = '/usr/share/doc/icinga2-ido-mysql-2.0.0/schema/mysql.sql' }
|
|
||||||
'pgsql': { $server_db_schema_path = '/usr/share/doc/icinga2-ido-pgsql-2.0.0/schema/pgsql.sql' }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#Debian/Ubuntu systems:
|
#Debian/Ubuntu systems:
|
||||||
|
@ -48,12 +42,6 @@ class icinga2::params {
|
||||||
$package_provider = 'apt'
|
$package_provider = 'apt'
|
||||||
#Icinga 2 server package
|
#Icinga 2 server package
|
||||||
$icinga2_server_package = 'icinga2'
|
$icinga2_server_package = 'icinga2'
|
||||||
|
|
||||||
#Pick set the right path where we can find the DB schema
|
|
||||||
case $server_db_type {
|
|
||||||
'mysql': { $server_db_schema_path = '/usr/share/icinga2-ido-mysql/schema/mysql.sql' }
|
|
||||||
'pgsql': { $server_db_schema_path = '/usr/share/icinga2-ido-pgsql/schema/pgsql.sql' }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#Fail if we're on any other OS:
|
#Fail if we're on any other OS:
|
||||||
|
|
|
@ -12,9 +12,42 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
class icinga2::server (
|
class icinga2::server (
|
||||||
$server_db_type = $icinga2::params::server_db_type
|
$manage_repos = $icinga2::params::manage_repos,
|
||||||
|
$server_db_type = $icinga2::params::server_db_type,
|
||||||
|
$db_name = $icinga2::params::db_name,
|
||||||
|
$db_user = $icinga2::params::db_user,
|
||||||
|
$db_password = $icinga2::params::db_password,
|
||||||
|
$db_host = $icinga2::params::db_host,
|
||||||
|
$package_provider = $icinga2::params::package_provider,
|
||||||
|
$icinga2_server_package = $icinga2::params::icinga2_server_package,
|
||||||
|
#$server_db_schema_path = $icinga2::params::server_db_schema_path
|
||||||
) inherits icinga2::params {
|
) inherits icinga2::params {
|
||||||
|
|
||||||
|
|
||||||
|
case $operatingsystem {
|
||||||
|
#Red Hat/CentOS systems:
|
||||||
|
'RedHat', 'CentOS': {
|
||||||
|
#Pick set the right path where we can find the DB schema
|
||||||
|
case $server_db_type {
|
||||||
|
'mysql': { $server_db_schema_path = '/usr/share/doc/icinga2-ido-mysql-2.0.0/schema/mysql.sql' }
|
||||||
|
'pgsql': { $server_db_schema_path = '/usr/share/doc/icinga2-ido-pgsql-2.0.0/schema/pgsql.sql' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Debian/Ubuntu systems:
|
||||||
|
/^(Debian|Ubuntu)$/: {
|
||||||
|
#Pick set the right path where we can find the DB schema
|
||||||
|
case $server_db_type {
|
||||||
|
'mysql': { $server_db_schema_path = '/usr/share/icinga2-ido-mysql/schema/mysql.sql' }
|
||||||
|
'pgsql': { $server_db_schema_path = '/usr/share/icinga2-ido-pgsql/schema/pgsql.sql' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Fail if we're on any other OS:
|
||||||
|
default: { fail("${operatingsystem} is not supported!") }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#Apply our classes in the right order. Use the squiggly arrows (~>) to ensure that the
|
#Apply our classes in the right order. Use the squiggly arrows (~>) to ensure that the
|
||||||
#class left is applied before the class on the right and that it also refreshes the
|
#class left is applied before the class on the right and that it also refreshes the
|
||||||
#class on the right.
|
#class on the right.
|
||||||
|
|
Loading…
Reference in a new issue