optimize error handling 0.3.1
authorarnold
Fri, 30 Nov 2012 13:11:40 +0100
changeset 6 29283ac86185
parent 5 1018228e9a11
child 7 50f46fd1e3f0
optimize error handling
check_ldap_repl.pl
debian/changelog
--- a/check_ldap_repl.pl	Fri Nov 30 11:13:56 2012 +0100
+++ b/check_ldap_repl.pl	Fri Nov 30 13:11:40 2012 +0100
@@ -43,7 +43,7 @@
 
 my $ME      = basename $0;
 my $NAME    = "LDAPREPL";
-my $VERSION = "0.3";
+my $VERSION = "0.3.1";
 
 my $master_default = "ldap://ldap-master:389/";
 my $slave_default = "ldap://ldap-slave:389/";
@@ -232,11 +232,6 @@
 	# delete check object
 	$mesg = $ldap->delete("cn=$cn,$context") if ($type eq "delete");
 
-	if ($mesg->code && ($type eq "delete" || $type eq "init")) {
-		print "$NAME WARNING: [ldapt] " . $mesg->error . "\n";
-		exit $ERRORS{WARNING};
-	}
-
 	# refresh check object
 	$mesg = $ldap->modify(
 		"cn=$cn,$context",
@@ -245,6 +240,11 @@
 		}
 	) if ($opt{refresh});
 
+	if ($mesg->code && ($type eq "delete" || $type eq "init" || $type eq "refresh")) {
+		print "$NAME WARNING: [ldapt] " . $mesg->error . "\n";
+		exit $ERRORS{WARNING};
+	}
+
 	$ldap->unbind() if ($ldap);
 	return 0;
 }
@@ -419,7 +419,7 @@
 
 =head1 VERSION
 
-This man page is current for version 0.3 of B<check_ldap_repl>.
+This man page is current for version 0.3.1 of B<check_ldap_repl>.
 
 =head1 AUTHOR
 
--- a/debian/changelog	Fri Nov 30 11:13:56 2012 +0100
+++ b/debian/changelog	Fri Nov 30 13:11:40 2012 +0100
@@ -1,3 +1,9 @@
+nagios-plugin-ldap-repl (0.3.1) stable; urgency=low
+
+  * optimize error handling 
+
+ -- Christian Arnold <arnold@schlittermann.de>  Fri, 30 Nov 2012 13:10:17 +0100
+
 nagios-plugin-ldap-repl (0.3) stable; urgency=low
 
   * fix option logic