commit nagios-plugins-zypper for openSUSE:Factory
Hello community, here is the log from the commit of package nagios-plugins-zypper for openSUSE:Factory checked in at Mon Sep 28 17:53:49 CEST 2009. -------- --- nagios-plugins-zypper/nagios-plugins-zypper.changes 2009-09-23 12:31:11.000000000 +0200 +++ nagios-plugins-zypper/nagios-plugins-zypper.changes 2009-09-28 16:51:38.000000000 +0200 @@ -1,0 +2,14 @@ +Mon Sep 28 16:51:03 CEST 2009 - lrupp@suse.de + +- update to 1.21: + + use --non-interactive everywhere + +------------------------------------------------------------------- +Sat Sep 26 12:00:03 CEST 2009 - lrupp@suse.de + +- update to 1.2: + + use the same zypper options for all openSUSE versions > 11.0 + (fixes bnc#538850) + + handle new message type 'warning' + +------------------------------------------------------------------- calling whatdependson for head-i586 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nagios-plugins-zypper.spec ++++++ --- /var/tmp/diff_new_pack.ZsdsAz/_old 2009-09-28 17:52:57.000000000 +0200 +++ /var/tmp/diff_new_pack.ZsdsAz/_new 2009-09-28 17:52:57.000000000 +0200 @@ -1,5 +1,5 @@ # -# spec file for package nagios-plugins-zypper (Version 1.1) +# spec file for package nagios-plugins-zypper (Version 1.21) # # Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -20,7 +20,7 @@ Name: nagios-plugins-zypper Summary: Nagios plugin for checking software updates -Version: 1.1 +Version: 1.21 Release: 1 Url: http://en.opensuse.org/Nagios-plugins-zypper License: BSD 4-clause (or similar) ++++++ check_zypper.pl ++++++ --- /var/tmp/diff_new_pack.ZsdsAz/_old 2009-09-28 17:52:57.000000000 +0200 +++ /var/tmp/diff_new_pack.ZsdsAz/_new 2009-09-28 17:52:57.000000000 +0200 @@ -49,7 +49,7 @@ # constants $PROGNAME="check_zypper"; -$VERSION="1.1"; +$VERSION="1.21"; $DEBUG = 0; # variables @@ -219,7 +219,7 @@ } sub check_errorcode($){ - my $status=shift || ""; + my $status=shift; my $level=0; my $returnvalue="OK"; $returnvalue="WARNING" if ("$opt_w" =~ /$status/); @@ -230,12 +230,30 @@ return "$returnvalue"; } +sub xml_re_escape($){ + my ($text) = @_; + $text =~ s/&/&/sg; + $text =~ s/</</sg; + $text =~ s/>/>/sg; + $text =~ s/"/"/sg; + $text =~ s/'/'/sg; + return $text; +} + +sub trim($){ + my ($text) = @_; + $text =~ s/^\s+//; + $text =~ s/\s+$//; + return $text; +} + sub check(){ my ($status,$ret_str,$error); my $secstr=""; my $recstr=""; my $optstr=""; my $pacstr=""; + my $warnstr=""; my $update_avail=0; my %packagelist; print STDERR "INFO: Trying $use_sudo $zypper $zypperopt\n" if ($DEBUG); @@ -245,17 +263,22 @@ my $category="unknown"; print STDERR "LINE: $_\n" if ($DEBUG); # error handling - return("UNKNOWN: $_","UNKNOWN") if (/not found on medium/); - return("UNKNOWN: $_","UNKNOWN") if (/I\/O error: Can't provide/); - return("UNKNOWN: $_","UNKNOWN") if (/Error message:/); - return("UNKNOWN: $_","UNKNOWN") if (/A ZYpp transaction is already in progress./); - return("UNKNOWN: $_","UNKNOWN") if (/System management is locked/); + return("UNKNOWN: ".xml_re_escape($_),"UNKNOWN") if (/not found on medium/); + return("UNKNOWN: ".xml_re_escape($_),"UNKNOWN") if (/I\/O error: Can't provide/); + return("UNKNOWN: ".xml_re_escape($_),"UNKNOWN") if (/Error message:/); + return("UNKNOWN: ".xml_re_escape($_),"UNKNOWN") if (/A ZYpp transaction is already in progress./); + return("UNKNOWN: ".xml_re_escape($_),"UNKNOWN") if (/System management is locked/); if ((/out-of-date/)&&(!$opt_o)){ - $error="WARNING"; - $exitcode=1; - $ret_str="WARNING: At least one of your Repositories is out of date. Please run \"zypper refresh\" as root to update it. "; - $ret_str.="\n" if ($opt_v); + $error=check_errorcode("security"); + $warnstr="At least one of your Repositories is out of date. Please run \"zypper refresh\" as root to update it. "; + $warnstr.="\n" if ($opt_v); } + if (/<message type=\"warning\">(.*)<\/message>/){ + $update_avail=1; + $error=check_errorcode("security"); + $warnstr=xml_re_escape($1)." "; + $warnstr.="\n" if ($opt_v); + } if (( "$release" eq "10.2" ) || ("$dist" eq "SLE") ){ my ($url,$name,$version,$category,$status)=split('\s*\|\s*',$_,5); # just for reference - perhaps we need the variables later if (defined($name)){ @@ -302,28 +325,28 @@ use Data::Dumper; print STDERR Data::Dumper->Dump([\%packagelist]); } - if (defined($packagelist{'package'})){ + if (defined($packagelist{'package'}) && (scalar(keys %{($packagelist{'package'})}) ne 0)){ $update_avail=1; $error=check_errorcode("packages"); $pacstr=scalar(keys %{($packagelist{'package'})})." package update(s);"; } - if (defined($packagelist{'optional'})){ + if (defined($packagelist{'optional'}) && (scalar(keys %{($packagelist{'optional'})}) ne 0)){ $update_avail=1; $error=check_errorcode("optional"); $optstr=scalar(keys %{($packagelist{'optional'})})." optinal update(s);"; } - if (defined($packagelist{'recommended'})){ + if (defined($packagelist{'recommended'}) && (scalar(keys %{($packagelist{'warning'})}) ne 0)){ $update_avail=1; $error=check_errorcode("recommended"); $recstr=scalar(keys %{($packagelist{'recommended'})})." recommended update(s);"; } - if (defined($packagelist{'security'})){ + if (defined($packagelist{'security'}) && (scalar(keys %{($packagelist{'security'})}) ne 0)){ $update_avail=1; $error=check_errorcode("security"); $secstr=scalar(keys %{($packagelist{'security'})})." security update(s);"; } if ( $update_avail ){ - $ret_str.="$error : $secstr $recstr $optstr $pacstr "; + $ret_str.="$error : ".trim("$warnstr $secstr $recstr $optstr $pacstr")." "; my @packagelist=(); if ( $opt_v ){ foreach my $cat ('security','recommended','optional','package'){ @@ -384,7 +407,6 @@ print "UNKNOWN - Plugin timed out\n"; exit $ERRORS{"UNKNOWN"}; }; - alarm($TIMEOUT); if ($opt_V) { @@ -394,22 +416,14 @@ ($dist,$release,$patchlevel)=get_distribution("$opt_f"); -if ("$release" eq "10.2"){ - $zypperopt="--non-interactive --no-gpg-checks list-updates"; -} - -if ("$release" eq "11.1"){ - $zypperopt="--xmlout list-updates -t package -t patch"; -} +$zypperopt="--non-interactive --no-gpg-checks list-updates" if ("$release" eq "10.2"); +$zypperopt="--xmlout --non-interactive list-updates -t package -t patch" if ($release gt 11.1); if ("$dist" eq "SLE"){ if (("$release" eq "10") && ($patchlevel gt 0)){ $zypperopt="--non-interactive --no-gpg-checks --terse list-updates"; - } elsif ("$release" eq "11"){ - $zypperopt="--xmlout list-updates -t package -t patch"; } else { - print "UNKNOWN - SLE $release is currently not supported\n"; - exit $ERRORS{"UNKNOWN"}; + $zypperopt="--xmlout --non-interactive list-updates -t package -t patch"; } } ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@Hilbert.suse.de