Create a new subclass (xymon::client::preconfig) to define some

variables.
This commit is contained in:
gardouille 2015-02-10 22:05:23 +01:00
parent 1cab78e5d6
commit 0ac697cfc0
3 changed files with 47 additions and 4 deletions

View File

@ -23,10 +23,15 @@
#
class xymon::client (
$download_dir = $xymon::params::download_dir,
$cli_new_version = $xymon::params::cli_new_version,
$cli_old_version = $xymon::params::cli_old_version,
$download_url = $xymon::params::download_url,
$new_version = $xymon::params::cli_new_version,
$package_name = $xymon::params::package_name,
) inherits xymon::params {
include '::xymon::client::preconfig'
include '::xymon::client::install'
Class['::xymon::client::preconfig'] ->
Class['::xymon::client::install']
} # Public class: xymon::client

View File

@ -0,0 +1,36 @@
# == Class: xymon::client::preconfig
#
# Some configurations before install Xymon client
#
class xymon::client::preconfig {
# Define the download URL
if $xymon::client::download_url == undef {
case $::osfamily {
'Debian': {
# From Xymon project via Sourceforge
$dl_url = "http://downloads.sourceforge.net/project/xymon/Xymon/${xymon::client::new_version}"
}
default: {
fail('Please define a download_url.')
}
}
} else {
$dl_url = $xymon::client::download_url
}
# Define the package name
if $xymon::client::package_name == undef {
case $::osfamily {
'Debian': {
$pkg_name = "xymon-client_${xymon::client::new_version}_${::architecture}.deb"
}
default: {
fail('Please define a package_name.')
}
}
} else {
$pkg_name = $xymon::client::package_name
}
} # Private class: xymon::client::preconfig

View File

@ -6,8 +6,10 @@ class xymon::params {
# Client
$download_dir = '/opt/xymon/packages'
$cli_new_version = '4.3.18'
$cli_old_version = '4.3.17'
$cli_new_version = '4.3.17'
$package_name = undef
$download_url = undef
}
default: {