Skip to content

Commit

Permalink
Merge pull request #110 from mmerfort/manage_repo
Browse files Browse the repository at this point in the history
Pass manage_repo and zabbix_repo to repo.pp and prevent double include
  • Loading branch information
Werner Dijkerman committed Jul 23, 2015
2 parents d5919f1 + 713f3d0 commit 8863bbe
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 17 deletions.
13 changes: 9 additions & 4 deletions manifests/agent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,15 @@
}
}

# Check if manage_repo is true.
if $manage_repo {
include zabbix::repo
Package['zabbix-agent'] {require => Class['zabbix::repo']}
# Only include the repo class if it has not yet been included
unless defined(Class['Zabbix::Repo']) {
class {'zabbix::repo':
manage_repo => $manage_repo,
zabbix_version => $zabbix_version,
}
Package['zabbix-agent'] {
require => Class['zabbix::repo']
}
}

# Installing the package
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
class { 'zabbix::web':
zabbix_url => $zabbix_url,
database_type => $database_type,
manage_repo => $manage_repo,
zabbix_version => $zabbix_version,
zabbix_timezone => $zabbix_timezone,
manage_vhost => $manage_vhost,
Expand Down Expand Up @@ -205,6 +206,7 @@
database_path => $database_path,
zabbix_version => $zabbix_version,
manage_firewall => $manage_firewall,
manage_repo => $manage_repo,
nodeid => $nodeid,
listenport => $listenport,
sourceip => $sourceip,
Expand Down
13 changes: 9 additions & 4 deletions manifests/javagateway.pp
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,15 @@
validate_bool($manage_firewall)
validate_bool($manage_repo)

# Check if manage_repo is true.
if $manage_repo {
include zabbix::repo
Package['zabbix-java-gateway'] {require => Class['zabbix::repo']}
# Only include the repo class if it has not yet been included
unless defind(Class['Zabbix::Repo']) {
class { 'zabbix::repo':
manage_repo => $manage_repo,
zabbix_version => $zabbix_version,
}
Package['zabbix-java-gateway'] {
require => Class['zabbix::repo']
}
}

# Installing the package
Expand Down
13 changes: 9 additions & 4 deletions manifests/proxy.pp
Original file line number Diff line number Diff line change
Expand Up @@ -450,10 +450,15 @@
}
}

# Check if manage_repo is true.
if $manage_repo {
include zabbix::repo
Package["zabbix-proxy-${db}"] {require => Class['zabbix::repo']}
# Only include the repo class if it has not yet been included
unless defind(Class['Zabbix::Repo']) {
class { 'zabbix::repo':
manage_repo => $manage_repo,
zabbix_version => $zabbix_version,
}
Package["zabbix-proxy-${db}"] {
require => Class['zabbix::repo']
}
}

# Now we are going to install the correct packages.
Expand Down
15 changes: 11 additions & 4 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
# This is the zabbix version.
# Example: 2.4
#
# [*manage_repo*]
# When true (default) this module will manage the Zabbix repository
#
# [*zabbix_package_state*]
# The state of the package that needs to be installed: present or latest.
# Default: present
Expand Down Expand Up @@ -263,6 +266,7 @@
$zabbix_version = $zabbix::params::zabbix_version,
$zabbix_package_state = $zabbix::params::zabbix_package_state,
$manage_firewall = $zabbix::params::manage_firewall,
$manage_repo = $zabbix::params::manage_repo,
$server_configfile_path = $zabbix::params::server_configfile_path,
$server_config_owner = $zabbix::params::server_config_owner,
$server_config_group = $zabbix::params::server_config_group,
Expand Down Expand Up @@ -332,11 +336,14 @@
$loadmodule = $zabbix::params::server_loadmodule,
) inherits zabbix::params {

class { 'zabbix::repo':
zabbix_version => $zabbix_version,
manage_repo => $manage_repo,
# Only include the repo class if it has not yet been included
unless defined(Class['Zabbix::Repo']) {
class { 'zabbix::repo':
zabbix_version => $zabbix_version,
manage_repo => $manage_repo,
}
}

# Check some if they are boolean
validate_bool($manage_firewall)

Expand Down
12 changes: 11 additions & 1 deletion manifests/web.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
# - postgresql
# - mysql
#
# [*manage_repo*]
# When true, it will create repository for installing the webinterface.
#
# [*zabbix_version*]
# This is the zabbix version.
# Example: 2.4
Expand Down Expand Up @@ -148,6 +151,7 @@
class zabbix::web (
$zabbix_url = '',
$database_type = $zabbix::params::database_type,
$manage_repo = $zabbix::params::manage_repo,
$zabbix_version = $zabbix::params::zabbix_version,
$zabbix_timezone = $zabbix::params::zabbix_timezone,
$zabbix_package_state = $zabbix::params::zabbix_package_state,
Expand Down Expand Up @@ -180,7 +184,13 @@
$apache_php_always_populate_raw_post_data = $zabbix::params::apache_php_always_populate_raw_post_data,
) inherits zabbix::params {

include zabbix::repo
# Only include the repo class if it has not yet been included
unless defined(Class['Zabbix::Repo']) {
class { 'zabbix::repo':
manage_repo => $manage_repo,
zabbix_version => $zabbix_version,
}
}

# use the correct db.
case $database_type {
Expand Down

0 comments on commit 8863bbe

Please sign in to comment.