Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package monitoring-plugins-nwc_health for openSUSE:Factory checked in at 2021-11-22 23:04:04 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/monitoring-plugins-nwc_health (Old) and /work/SRC/openSUSE:Factory/.monitoring-plugins-nwc_health.new.1895 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "monitoring-plugins-nwc_health" Mon Nov 22 23:04:04 2021 rev:16 rq:932884 version:10.0 Changes: -------- --- /work/SRC/openSUSE:Factory/monitoring-plugins-nwc_health/monitoring-plugins-nwc_health.changes 2021-10-26 20:14:56.562049391 +0200 +++ /work/SRC/openSUSE:Factory/.monitoring-plugins-nwc_health.new.1895/monitoring-plugins-nwc_health.changes 2021-11-22 23:04:49.337803536 +0100 @@ -1,0 +2,6 @@ +Thu Nov 18 21:03:27 UTC 2021 - Martin Hauke <mar...@gmx.de> + +- Update to version 10.0 + * use json for temporary files + +------------------------------------------------------------------- Old: ---- check_nwc_health-9.1.tar.gz New: ---- check_nwc_health-10.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ monitoring-plugins-nwc_health.spec ++++++ --- /var/tmp/diff_new_pack.DcJTYM/_old 2021-11-22 23:04:49.765802099 +0100 +++ /var/tmp/diff_new_pack.DcJTYM/_new 2021-11-22 23:04:49.765802099 +0100 @@ -19,7 +19,7 @@ %define realname check_nwc_health Name: monitoring-plugins-nwc_health -Version: 9.1 +Version: 10.0 Release: 0 Summary: This plugin checks the health of network components and interfaces # https://github.com/lausser/check_nwc_health ++++++ check_nwc_health-9.1.tar.gz -> check_nwc_health-10.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/check_nwc_health-9.1/ChangeLog new/check_nwc_health-10.0/ChangeLog --- old/check_nwc_health-9.1/ChangeLog 2021-10-13 11:59:07.804410600 +0200 +++ new/check_nwc_health-10.0/ChangeLog 2021-11-16 21:25:17.070767500 +0100 @@ -1,3 +1,5 @@ +* 2021-11-16 10.0 + use json for temporary files * 2021-10-13 9.1 add Pulse Secure * 2021-10-08 9.0.1.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/check_nwc_health-9.1/GLPlugin/lib/Monitoring/GLPlugin/SNMP.pm new/check_nwc_health-10.0/GLPlugin/lib/Monitoring/GLPlugin/SNMP.pm --- old/check_nwc_health-9.1/GLPlugin/lib/Monitoring/GLPlugin/SNMP.pm 2021-10-13 11:59:08.374410600 +0200 +++ new/check_nwc_health-10.0/GLPlugin/lib/Monitoring/GLPlugin/SNMP.pm 2021-11-16 21:25:17.710767500 +0100 @@ -5,6 +5,8 @@ use strict; use File::Basename; use Digest::MD5 qw(md5_hex); +use JSON; +use File::Slurp qw(read_file); use Module::Load; use AutoLoader; our $AUTOLOAD; @@ -1658,9 +1660,14 @@ $self->create_statefilesdir(); my $statefile = $self->create_entry_cache_file($mib, $table, join('#', @{$key_attrs})); my $tmpfile = $statefile.$$.rand(); - open(STATE, ">".$tmpfile); - printf STATE Data::Dumper::Dumper($self->{$cache}); - close STATE; + my $fh = IO::File->new(); + if ($fh->open($tmpfile, "w")) { + my $coder = JSON::XS->new->ascii->pretty->allow_nonref; + my $jsonscalar = $coder->encode($self->{$cache}); + $fh->print($jsonscalar); + $fh->flush(); + $fh->close(); + } rename $tmpfile, $statefile; $self->debug(sprintf "saved %s to %s", Data::Dumper::Dumper($self->{$cache}), $statefile); @@ -1672,25 +1679,26 @@ my $statefile = $self->create_entry_cache_file($mib, $table, join('#', @{$key_attrs})); $self->{$cache} = {}; if ( -f $statefile) { + my $jsonscalar = read_file($statefile); our $VAR1; - our $VAR2; eval { - require $statefile; + my $coder = JSON::XS->new->ascii->pretty->allow_nonref; + $VAR1 = $coder->decode($jsonscalar); }; if($@) { - printf "FATAL: Could not load cache!\n"; + $self->debug(sprintf "json load from %s failed. fallback", $statefile); + delete $INC{$statefile} if exists $INC{$statefile}; # else unit tests fail + eval "$jsonscalar"; + if($@) { + printf "FATAL: Could not load cache in perl format!\n"; + $self->debug(sprintf "fallback perl load from %s failed", $statefile); + } } - # keinesfalls mehr require verwenden!!!!!! - # beim require enthaelt VAR1 andere werte als beim slurp - # und zwar diejenigen, die beim letzten save_cache geschrieben wurden. - my $content = do { local (@ARGV, $/) = $statefile; my $x = <>; close ARGV; $x }; - $VAR1 = eval "$content"; $self->debug(sprintf "load %s", Data::Dumper::Dumper($VAR1)); $self->{$cache} = $VAR1; } } - ################################################################ # top-level convenience functions # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/check_nwc_health-9.1/GLPlugin/lib/Monitoring/GLPlugin.pm new/check_nwc_health-10.0/GLPlugin/lib/Monitoring/GLPlugin.pm --- old/check_nwc_health-9.1/GLPlugin/lib/Monitoring/GLPlugin.pm 2021-10-13 11:59:08.174410600 +0200 +++ new/check_nwc_health-10.0/GLPlugin/lib/Monitoring/GLPlugin.pm 2021-11-16 21:25:17.490767500 +0100 @@ -11,6 +11,8 @@ use File::Basename; use Digest::MD5 qw(md5_hex); use Errno; +use JSON; +use File::Slurp qw(read_file); use Data::Dumper; $Data::Dumper::Indent = 1; eval { @@ -20,7 +22,7 @@ $Data::Dumper::Sparseseen = 1; }; our $AUTOLOAD; -*VERSION = \'3.4.6'; +*VERSION = \'5.0'; use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 }; @@ -1481,7 +1483,11 @@ } my $seekfh = IO::File->new(); if ($seekfh->open($tmpfile, "w")) { - $seekfh->printf("%s", Data::Dumper::Dumper($params{save})); + my $coder = JSON::XS->new->ascii->pretty->allow_nonref; + my $jsonscalar = $coder->encode($params{save}); + $seekfh->print($jsonscalar); + # the very time-consuming old way. + # $seekfh->printf("%s", Data::Dumper::Dumper($params{save})); $seekfh->flush(); $seekfh->close(); $self->debug(sprintf "saved %s to %s", @@ -1500,10 +1506,18 @@ our $VAR1; eval { delete $INC{$statefile} if exists $INC{$statefile}; # else unit tests fail - require $statefile; + my $jsonscalar = read_file($statefile); + my $coder = JSON::XS->new->ascii->pretty->allow_nonref; + $VAR1 = $coder->decode($jsonscalar); }; if($@) { - printf "FATAL: Could not load state!\n"; + $self->debug(sprintf "json load from %s failed. fallback", $statefile); + eval { + require $statefile; + }; + if($@) { + printf "FATAL: Could not load old state in perl format!\n"; + } } $self->debug(sprintf "load %s from %s", Data::Dumper::Dumper($VAR1), $statefile); return $VAR1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/check_nwc_health-9.1/Makefile.in new/check_nwc_health-10.0/Makefile.in --- old/check_nwc_health-9.1/Makefile.in 2021-10-13 11:59:08.164410600 +0200 +++ new/check_nwc_health-10.0/Makefile.in 2021-11-16 21:25:17.490767500 +0100 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -197,8 +197,6 @@ DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip -# Exists only to be overridden by the user if desired. -AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' @@ -525,10 +523,6 @@ tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) -dist-zstd: distdir - tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst - $(am__post_remove_distdir) - dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @@ -571,8 +565,6 @@ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ - *.tar.zst*) \ - zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) @@ -588,7 +580,7 @@ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ @@ -749,17 +741,16 @@ am--refresh check check-am clean clean-cscope clean-generic \ cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-hook dist-lzip dist-shar dist-tarZ dist-xz \ - dist-zip dist-zstd distcheck distclean distclean-generic \ - distclean-tags distcleancheck distdir distuninstallcheck dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs installdirs-am \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ - uninstall-am + dist-zip distcheck distclean distclean-generic distclean-tags \ + distcleancheck distdir distuninstallcheck dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am tags tags-am uninstall uninstall-am .PRECIOUS: Makefile diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/check_nwc_health-9.1/aclocal.m4 new/check_nwc_health-10.0/aclocal.m4 --- old/check_nwc_health-9.1/aclocal.m4 2021-10-13 11:59:08.164410600 +0200 +++ new/check_nwc_health-10.0/aclocal.m4 2021-11-16 21:25:17.490767500 +0100 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.16.3 -*- Autoconf -*- +# generated automatically by aclocal 1.16.1 -*- Autoconf -*- -# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,7 @@ If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2020 Free Software Foundation, Inc. +# Copyright (C) 2002-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -35,7 +35,7 @@ [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.16.3], [], +m4_if([$1], [1.16.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,14 +51,14 @@ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.16.3])dnl +[AM_AUTOMAKE_VERSION([1.16.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -110,7 +110,7 @@ # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2020 Free Software Foundation, Inc. +# Copyright (C) 1997-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -143,7 +143,7 @@ # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -340,7 +340,7 @@ done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -361,7 +361,7 @@ fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2020 Free Software Foundation, Inc. +# Copyright (C) 2003-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -383,7 +383,7 @@ # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering -# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -418,7 +418,7 @@ # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2020 Free Software Foundation, Inc. +# Copyright (C) 1997-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -439,7 +439,12 @@ [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then - MISSING="\${SHELL} '$am_aux_dir/missing'" + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then @@ -452,7 +457,7 @@ # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -481,7 +486,7 @@ AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -500,7 +505,7 @@ # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -581,7 +586,7 @@ rm -f conftest.file ]) -# Copyright (C) 2009-2020 Free Software Foundation, Inc. +# Copyright (C) 2009-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -641,7 +646,7 @@ _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -669,7 +674,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2020 Free Software Foundation, Inc. +# Copyright (C) 2006-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -688,7 +693,7 @@ # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2020 Free Software Foundation, Inc. +# Copyright (C) 2004-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/check_nwc_health-9.1/configure new/check_nwc_health-10.0/configure --- old/check_nwc_health-9.1/configure 2021-10-13 11:59:05.164410600 +0200 +++ new/check_nwc_health-10.0/configure 2021-11-16 21:25:14.380767500 +0100 @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for check_nwc_health 9.1. +# Generated by GNU Autoconf 2.69 for check_nwc_health 10.0. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -577,8 +577,8 @@ # Identity of this package. PACKAGE_NAME='check_nwc_health' PACKAGE_TARNAME='check_nwc_health' -PACKAGE_VERSION='9.1' -PACKAGE_STRING='check_nwc_health 9.1' +PACKAGE_VERSION='10.0' +PACKAGE_STRING='check_nwc_health 10.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1236,7 +1236,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures check_nwc_health 9.1 to adapt to many kinds of systems. +\`configure' configures check_nwc_health 10.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1308,7 +1308,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of check_nwc_health 9.1:";; + short | recursive ) echo "Configuration of check_nwc_health 10.0:";; esac cat <<\_ACEOF @@ -1393,7 +1393,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -check_nwc_health configure 9.1 +check_nwc_health configure 10.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1410,7 +1410,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by check_nwc_health $as_me 9.1, which was +It was created by check_nwc_health $as_me 10.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -1963,7 +1963,12 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then - MISSING="\${SHELL} '$am_aux_dir/missing'" + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then @@ -2268,7 +2273,7 @@ # Define the identity of the package. PACKAGE='check_nwc_health' - VERSION='9.1' + VERSION='10.0' cat >>confdefs.h <<_ACEOF @@ -3319,7 +3324,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by check_nwc_health $as_me 9.1, which was +This file was extended by check_nwc_health $as_me 10.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -3372,7 +3377,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -check_nwc_health config.status 9.1 +check_nwc_health config.status 10.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/check_nwc_health-9.1/configure.ac new/check_nwc_health-10.0/configure.ac --- old/check_nwc_health-9.1/configure.ac 2021-10-13 11:59:07.804410600 +0200 +++ new/check_nwc_health-10.0/configure.ac 2021-11-16 21:25:17.070767500 +0100 @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_REVISION ($Revision: 1.150 $) AC_PREREQ(2.58) -AC_INIT(check_nwc_health,9.1) +AC_INIT(check_nwc_health,10.0) AM_INIT_AUTOMAKE([1.9 tar-pax]) AM_MAINTAINER_MODE([disable]) AC_CANONICAL_HOST diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/check_nwc_health-9.1/plugins-scripts/Classes/IFMIB/Component/InterfaceSubsystem.pm new/check_nwc_health-10.0/plugins-scripts/Classes/IFMIB/Component/InterfaceSubsystem.pm --- old/check_nwc_health-9.1/plugins-scripts/Classes/IFMIB/Component/InterfaceSubsystem.pm 2021-10-13 11:59:07.824410600 +0200 +++ new/check_nwc_health-10.0/plugins-scripts/Classes/IFMIB/Component/InterfaceSubsystem.pm 2021-11-16 21:25:17.090767500 +0100 @@ -1,6 +1,8 @@ package Classes::IFMIB::Component::InterfaceSubsystem; our @ISA = qw(Monitoring::GLPlugin::SNMP::Item); use strict; +use JSON; +use File::Slurp qw(read_file); sub init { my ($self) = @_; @@ -575,40 +577,39 @@ my $statefile = $self->create_interface_cache_file(); my $tmpfile = $self->statefilesdir().'/check_nwc_health_tmp_'.$$; my $fh = IO::File->new(); - $fh->open(">$tmpfile"); - $fh->print(Data::Dumper::Dumper($self->{interface_cache})); - $fh->flush(); - $fh->close(); - my $ren = rename $tmpfile, $statefile; + if ($fh->open($tmpfile, "w")) { + my $coder = JSON::XS->new->ascii->pretty->allow_nonref; + my $jsonscalar = $coder->encode($self->{interface_cache}); + $fh->print($jsonscalar); + $fh->flush(); + $fh->close(); + } + rename $tmpfile, $statefile; $self->debug(sprintf "saved %s to %s", Data::Dumper::Dumper($self->{interface_cache}), $statefile); - } sub load_interface_cache { my ($self) = @_; my $statefile = $self->create_interface_cache_file(); if ( -f $statefile) { + my $jsonscalar = read_file($statefile); our $VAR1; eval { - require $statefile; + my $coder = JSON::XS->new->ascii->pretty->allow_nonref; + $VAR1 = $coder->decode($jsonscalar); }; if($@) { - printf "FATAL: Could not load cache!\n"; + $self->debug(sprintf "json load from %s failed. fallback", $statefile); + delete $INC{$statefile} if exists $INC{$statefile}; # else unit tests fail + eval "$jsonscalar"; + if($@) { + printf "FATAL: Could not load interface cache in perl format!\n"; + $self->debug(sprintf "fallback perl load from %s failed", $statefile); + } } $self->debug(sprintf "load %s", Data::Dumper::Dumper($VAR1)); $self->{interface_cache} = $VAR1; - eval { - foreach (keys %{$self->{interface_cache}}) { - /^\d+$/ || die "newrelease"; - } - }; - if($@) { - $self->{interface_cache} = {}; - unlink $statefile; - delete $INC{$statefile}; - $self->update_interface_cache(1); - } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/check_nwc_health-9.1/plugins-scripts/Classes/UPNP/AVM/FritzBox7390/Components/SmartHomeSubsystem.pm new/check_nwc_health-10.0/plugins-scripts/Classes/UPNP/AVM/FritzBox7390/Components/SmartHomeSubsystem.pm --- old/check_nwc_health-9.1/plugins-scripts/Classes/UPNP/AVM/FritzBox7390/Components/SmartHomeSubsystem.pm 2021-10-13 11:59:07.824410600 +0200 +++ new/check_nwc_health-10.0/plugins-scripts/Classes/UPNP/AVM/FritzBox7390/Components/SmartHomeSubsystem.pm 2021-11-16 21:25:17.100767500 +0100 @@ -1,6 +1,8 @@ package Classes::UPNP::AVM::FritzBox7390::Component::SmartHomeSubsystem; our @ISA = qw(Monitoring::GLPlugin::SNMP::Item Classes::UPNP::AVM::FritzBox7390); use strict; +use JSON; +use File::Slurp qw(read_file); sub init { my ($self) = @_; @@ -73,11 +75,14 @@ my $statefile = $self->create_device_cache_file(); my $tmpfile = $self->statefilesdir().'/check_nwc_health_tmp_'.$$; my $fh = IO::File->new(); - $fh->open(">$tmpfile"); - $fh->print(Data::Dumper::Dumper($self->{device_cache})); - $fh->flush(); - $fh->close(); - my $ren = rename $tmpfile, $statefile; + if ($fh->open($tmpfile, "w")) { + my $coder = JSON::XS->new->ascii->pretty->allow_nonref; + my $jsonscalar = $coder->encode($self->{device_cache}); + $fh->print($jsonscalar); + $fh->flush(); + $fh->close(); + } + rename $tmpfile, $statefile; $self->debug(sprintf "saved %s to %s", Data::Dumper::Dumper($self->{device_cache}), $statefile); } @@ -86,26 +91,23 @@ my ($self) = @_; my $statefile = $self->create_device_cache_file(); if ( -f $statefile) { + my $jsonscalar = read_file($statefile); our $VAR1; eval { - require $statefile; + my $coder = JSON::XS->new->ascii->pretty->allow_nonref; + $VAR1 = $coder->decode($jsonscalar); }; if($@) { - printf "FATAL: Could not load cache!\n"; + $self->debug(sprintf "json load from %s failed. fallback", $statefile); + delete $INC{$statefile} if exists $INC{$statefile}; # else unit tests fail + eval "$jsonscalar"; + if($@) { + printf "FATAL: Could not load cache in perl format!\n"; + $self->debug(sprintf "fallback perl load from %s failed", $statefile); + } } $self->debug(sprintf "load %s", Data::Dumper::Dumper($VAR1)); $self->{device_cache} = $VAR1; - eval { - foreach (keys %{$self->{device_cache}}) { - /^[\d\s]+$/ || die "newrelease"; - } - }; - if($@) { - $self->{device_cache} = {}; - unlink $statefile; - delete $INC{$statefile}; - $self->update_device_cache(1); - } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/check_nwc_health-9.1/plugins-scripts/Makefile.in new/check_nwc_health-10.0/plugins-scripts/Makefile.in --- old/check_nwc_health-9.1/plugins-scripts/Makefile.in 2021-10-13 11:59:08.164410600 +0200 +++ new/check_nwc_health-10.0/plugins-scripts/Makefile.in 2021-11-16 21:25:17.480767500 +0100 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it,