Giuseppe Lavagetto has uploaded a new change for review. ( 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_respources 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(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/90/394590/1 diff --git a/modules/monitoring/manifests/exported_nagios_host.pp b/modules/monitoring/manifests/exported_nagios_host.pp new file mode 100644 index 0000000..ebb7461 --- /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, + $parents, + $address, + $hostgroups, + $check_command, + $check_period, + $max_check_attempts, + $notification_interval, + $notification_period, + $notification_options, + $notifications_enabled, + $contact_groups, + $icon_image, + $vrml_image, + $statusmap_image, +) { + @@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..90db9e7 --- /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, + $real_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 => $real_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..6bc72c1 100644 --- a/modules/monitoring/manifests/host.pp +++ b/modules/monitoring/manifests/host.pp @@ -98,7 +98,6 @@ $host = { "${title}" => { ensure => $ensure, - host_name => $title, parents => $real_parents, address => $nagios_address, hostgroups => $hostgroup, @@ -120,7 +119,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: newchange Gerrit-Change-Id: I9e2cefe739551dbd5e2a16b7d3f775f63613732a Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Giuseppe Lavagetto <glavage...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits