From 7d3e57ff3f36e87dcb8085046a75b710b1cb3a4b Mon Sep 17 00:00:00 2001 From: Swann Croiset Date: Wed, 26 Aug 2015 18:47:31 +0200 Subject: [PATCH] Be idempotent with concatenated strings Change-Id: I2ad22d0c55a8ad11c3be81da6cc8ecbeb90ac422 --- .../puppet/modules/nagios/manifests/contact.pp | 6 +++--- deployment_scripts/puppet/modules/nagios/manifests/host.pp | 2 +- .../puppet/modules/nagios/manifests/hostgroup.pp | 4 ++-- .../puppet/modules/nagios/manifests/service.pp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/deployment_scripts/puppet/modules/nagios/manifests/contact.pp b/deployment_scripts/puppet/modules/nagios/manifests/contact.pp index a64bbdc..977b4be 100644 --- a/deployment_scripts/puppet/modules/nagios/manifests/contact.pp +++ b/deployment_scripts/puppet/modules/nagios/manifests/contact.pp @@ -60,7 +60,7 @@ define nagios::contact ( } if is_array($properties['contactgroups']){ - $opts['contactgroups'] = join($properties['contactgroups'], ',') + $opts['contactgroups'] = join(sort($properties['contactgroups']), ',') }else{ $opts['contactgroups'] = $properties['contactgroups'] } @@ -97,13 +97,13 @@ define nagios::contact ( } } if is_array($properties['service_notification_commands']) { - $opts['service_notification_commands'] = join($properties['service_notification_commands'], ',') + $opts['service_notification_commands'] = join(sort($properties['service_notification_commands']), ',') } if $properties['host_notification_commands'] == undef { $opts['host_notification_commands'] = $nagios::params::host_notification_commands } if is_array($properties['host_notification_commands']) { - $opts['host_notification_commands'] = join($properties['host_notification_commands'], ',') + $opts['host_notification_commands'] = join(sort($properties['host_notification_commands']), ',') } if $onefile { diff --git a/deployment_scripts/puppet/modules/nagios/manifests/host.pp b/deployment_scripts/puppet/modules/nagios/manifests/host.pp index 5a206a4..200f17b 100644 --- a/deployment_scripts/puppet/modules/nagios/manifests/host.pp +++ b/deployment_scripts/puppet/modules/nagios/manifests/host.pp @@ -36,7 +36,7 @@ define nagios::host ( $opts = {} if is_array($properties['contact_groups']){ - $opts['contact_groups'] = join($properties['contact_groups'], ',') + $opts['contact_groups'] = join(sort($properties['contact_groups']), ',') }else{ $opts['contact_groups'] = $properties['contact_groups'] } diff --git a/deployment_scripts/puppet/modules/nagios/manifests/hostgroup.pp b/deployment_scripts/puppet/modules/nagios/manifests/hostgroup.pp index a7c17f6..1ee8383 100644 --- a/deployment_scripts/puppet/modules/nagios/manifests/hostgroup.pp +++ b/deployment_scripts/puppet/modules/nagios/manifests/hostgroup.pp @@ -35,13 +35,13 @@ define nagios::hostgroup ( $opts = {} if is_array($properties['members']){ - $opts['members'] = join($properties['members'], ',') + $opts['members'] = join(sort($properties['members']), ',') } elsif $properties['members']{ $opts['members'] = $properties['members'] } if is_array($properties['hostgroup_members']){ - $opts['hostgroup_members'] = join($properties['hostgroup_members'], ',') + $opts['hostgroup_members'] = join(sort($properties['hostgroup_members']), ',') }elsif $properties['hostgroup_members']{ $opts['hostgroup_members'] = $properties['hostgroup_members'] } diff --git a/deployment_scripts/puppet/modules/nagios/manifests/service.pp b/deployment_scripts/puppet/modules/nagios/manifests/service.pp index d1fd00b..9e18bcb 100644 --- a/deployment_scripts/puppet/modules/nagios/manifests/service.pp +++ b/deployment_scripts/puppet/modules/nagios/manifests/service.pp @@ -36,13 +36,13 @@ define nagios::service ( $opts = {} if is_array($properties['contact_groups']){ - $opts['contact_groups'] = join($properties['contact_groups'], ',') + $opts['contact_groups'] = join(sort($properties['contact_groups']), ',') }else{ $opts['contact_groups'] = $properties['contact_groups'] } if is_array($properties['hostgroup_name']){ - $opts['hostgroup_name'] = join($properties['hostgroup_name'], ',') + $opts['hostgroup_name'] = join(sort($properties['hostgroup_name']), ',') }else{ $opts['hostgroup_name'] = $properties['hostgroup_name'] }