Giuseppe Lavagetto has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/394590 )
Change subject: monitoring: workaround puppet 4.x bug with created_resources ...................................................................... monitoring: workaround puppet 4.x bug with created_resources As reported in https://tickets.puppetlabs.com/browse/PUP-6698, create_resources in puppet 4.x does not honour the request of resources to be exported. But if we create a resource that encapsulates an exported resource, we obtain the correct behaviour. Yuck. Change-Id: I9e2cefe739551dbd5e2a16b7d3f775f63613732a --- A modules/monitoring/manifests/exported_nagios_host.pp A modules/monitoring/manifests/exported_nagios_service.pp M modules/monitoring/manifests/host.pp M modules/monitoring/manifests/service.pp 4 files changed, 91 insertions(+), 2 deletions(-) Approvals: Giuseppe Lavagetto: Looks good to me, approved jenkins-bot: Verified Volans: Looks good to me, but someone else must approve diff --git a/modules/monitoring/manifests/exported_nagios_host.pp b/modules/monitoring/manifests/exported_nagios_host.pp new file mode 100644 index 0000000..9b1cc4f --- /dev/null +++ b/modules/monitoring/manifests/exported_nagios_host.pp @@ -0,0 +1,40 @@ +# proxy to an exported nagios_host definition +# Used as a workaround of https://tickets.puppetlabs.com/browse/PUP-6698 +define monitoring::exported_nagios_host ( + $ensure, + $host_name, + $address, + $hostgroups, + $check_command, + $check_period, + $max_check_attempts, + $notification_interval, + $notification_period, + $notification_options, + $contact_groups, + $icon_image, + $vrml_image, + $statusmap_image, + $parents=undef, + $notifications_enabled='1', +) { + @@nagios_host { $title: + ensure => $ensure, + host_name => $host_name, + parents => $parents, + address => $address, + hostgroups => $hostgroups, + check_command => $check_command, + check_period => $check_period, + max_check_attempts => $max_check_attempts, + notifications_enabled => $notifications_enabled, + contact_groups => $contact_groups, + notification_interval => $notification_interval, + notification_period => $notification_period, + notification_options => $notification_options, + icon_image => $icon_image, + vrml_image => $vrml_image, + statusmap_image => $statusmap_image, + + } +} diff --git a/modules/monitoring/manifests/exported_nagios_service.pp b/modules/monitoring/manifests/exported_nagios_service.pp new file mode 100644 index 0000000..45b4e66 --- /dev/null +++ b/modules/monitoring/manifests/exported_nagios_service.pp @@ -0,0 +1,49 @@ +# proxy to an exported nagios_service definition +# Used as a workaround of https://tickets.puppetlabs.com/browse/PUP-6698 +define monitoring::exported_nagios_service ( + $ensure, + $host_name, + $servicegroups, + $service_description, + $check_command, + $max_check_attempts, + $check_interval, + $retry_interval, + $check_period, + $notification_interval, + $notification_period, + $notification_options, + $notifications_enabled, + $contact_groups, + $passive_checks_enabled, + $active_checks_enabled, + $is_volatile, + $check_freshness, + $freshness_threshold, + $event_handler, + $notes_url, +) { + @@nagios_service { $title: + ensure => $ensure, + host_name => $host_name, + servicegroups => $servicegroups, + service_description => $service_description, + check_command => $check_command, + max_check_attempts => $max_check_attempts, + check_interval => $check_interval, + retry_interval => $retry_interval, + check_period => $check_period, + notification_interval => $notification_interval, + notification_period => $notification_period, + notification_options => $notification_options, + notifications_enabled => $notifications_enabled, + contact_groups => $contact_groups, + passive_checks_enabled => $passive_checks_enabled, + active_checks_enabled => $active_checks_enabled, + is_volatile => $is_volatile, + check_freshness => $check_freshness, + freshness_threshold => $freshness_threshold, + event_handler => $event_handler, + notes_url => $notes_url, + } +} diff --git a/modules/monitoring/manifests/host.pp b/modules/monitoring/manifests/host.pp index f17fbf0..2742d8f 100644 --- a/modules/monitoring/manifests/host.pp +++ b/modules/monitoring/manifests/host.pp @@ -120,7 +120,7 @@ if defined(Class['icinga']) { $rtype = 'nagios_host' } else { - $rtype = '@@nagios_host' + $rtype = 'monitoring::exported_nagios_host' } create_resources($rtype, $host) if !empty($mgmt_host) { diff --git a/modules/monitoring/manifests/service.pp b/modules/monitoring/manifests/service.pp index 4d7faa5..63fbd19 100644 --- a/modules/monitoring/manifests/service.pp +++ b/modules/monitoring/manifests/service.pp @@ -112,6 +112,6 @@ if defined(Class['icinga']) { create_resources(nagios_service, $service) } else { - create_resources('@@nagios_service', $service) + create_resources('monitoring::exported_nagios_service', $service) } } -- To view, visit https://gerrit.wikimedia.org/r/394590 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9e2cefe739551dbd5e2a16b7d3f775f63613732a Gerrit-PatchSet: 2 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Giuseppe Lavagetto <[email protected]> Gerrit-Reviewer: Alexandros Kosiaris <[email protected]> Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]> Gerrit-Reviewer: Volans <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
