[Pkg-nagios-changes] [pkg-lconf] 01/08: Added patch 11_hostgroup_aliases
Markus Frosch
lazyfrosch-guest at moszumanska.debian.org
Wed Feb 26 11:33:51 UTC 2014
This is an automated email from the git hooks/post-receive script.
lazyfrosch-guest pushed a commit to branch debmon-wheezy
in repository pkg-lconf.
commit 8c59a005bfc769670fe0f9db42aac05e44169277
Author: Markus Frosch <markus at lazyfrosch.de>
Date: Wed Feb 26 12:01:00 2014 +0100
Added patch 11_hostgroup_aliases
See https://www.netways.org/issues/2501
---
debian/patches/11_hostgroup_aliases | 58 +++++++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 59 insertions(+)
diff --git a/debian/patches/11_hostgroup_aliases b/debian/patches/11_hostgroup_aliases
new file mode 100644
index 0000000..ce5e201
--- /dev/null
+++ b/debian/patches/11_hostgroup_aliases
@@ -0,0 +1,58 @@
+From 3eb2a7e58d9257a7824c4214c2516ddd1ead0222 Mon Sep 17 00:00:00 2001
+From: Markus Frosch <markus at lazyfrosch.de>
+Date: Wed, 26 Feb 2014 11:58:34 +0100
+Subject: [PATCH] Fixed hostgroup handling so no duplicate hostgroups are
+ processed.
+
+Fix for 1.3.x branch
+
+Refs #2501
+---
+ src/generate.pm.in | 26 ++++++++++++++++++++++----
+ 1 file changed, 22 insertions(+), 4 deletions(-)
+
+diff --git a/src/generate.pm.in b/src/generate.pm.in
+index 7228f5d..ae541c4 100644
+--- a/src/generate.pm.in
++++ b/src/generate.pm.in
+@@ -234,15 +234,33 @@ sub genHostgroups {
+
+ }
+
++ my @hg_existing = keys %{$result};
++
+ # get all hostgroups defined by hostobject
+ foreach my $client (keys %{$CLIENTS}) {
+ if (defined $CLIENTS->{$client}->{"$cfg->{ldap}->{prefix}hostgroups"}) {
+ # multiple or a single hostgroup?
++ my @val;
++
+ if ($CLIENTS->{$client}->{"$cfg->{ldap}->{prefix}hostgroups"} =~ /,/) {
+- my @val = split(/\s*,\s*/, $CLIENTS->{$client}->{"$cfg->{ldap}->{prefix}hostgroups"});
+- foreach(@val) { $result->{$_}->{cn} = $_ if $_ ne ''; }
+- } else {
+- $result->{$CLIENTS->{$client}->{"$cfg->{ldap}->{prefix}hostgroups"}}->{cn} = $CLIENTS->{$client}->{"$cfg->{ldap}->{prefix}hostgroups"};
++ @val = split(/\s*,\s*/, $CLIENTS->{$client}->{"$cfg->{ldap}->{prefix}hostgroups"});
++ }
++ else {
++ @val = ($CLIENTS->{$client}->{"$cfg->{ldap}->{prefix}hostgroups"});
++ }
++ foreach(@val) {
++ next if $_ eq '';
++
++ my $found = 0;
++ # search for matching hostgroups
++ foreach my $hg (@hg_existing) {
++ if ($hg =~ /^cn=$_,/) {
++ $found = 1;
++ last;
++ }
++ }
++ # create hostgroup when nothing found
++ $result->{$_}->{cn} = $_ if ($found == 0);
+ }
+ }
+ }
+--
+1.8.5.3
+
diff --git a/debian/patches/series b/debian/patches/series
index 776b986..52420af 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
01_avoid_install_with_owners
+11_hostgroup_aliases
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-lconf.git
More information about the Pkg-nagios-changes
mailing list