Hello community, here is the log from the commit of package icinga2 for openSUSE:Factory checked in at 2018-09-28 08:53:05 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/icinga2 (Old) and /work/SRC/openSUSE:Factory/.icinga2.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "icinga2" Fri Sep 28 08:53:05 2018 rev:11 rq:638372 version:2.9.2 Changes: -------- --- /work/SRC/openSUSE:Factory/icinga2/icinga2.changes 2018-07-31 15:59:11.135524661 +0200 +++ /work/SRC/openSUSE:Factory/.icinga2.new/icinga2.changes 2018-09-28 08:53:06.993753720 +0200 @@ -1,0 +2,45 @@ +Wed Sep 26 10:01:29 UTC 2018 - [email protected] + +- update to 2.9.2 + * Enhancement + - #6602 (API, Cluster, PR): Improve TLS handshake exception logging + - #6568 (Configuration, PR): Ensure that config object types are committed in dependent load order + - #6497 (Configuration, PR): Improve error logging for match/regex/cidr_match functions and unsupported + dictionary usage + * Bug + - #6596 (Crash, PR): Fix crash on API queries with Fedora 28 hardening and GCC 8 + - #6581 (Configuration, PR): Shuffle items before config validation + - #6569 (DB IDO): Custom Vars not updated after upgrade + - #6533 (Crash): Icinga2 crashes after using some api-commands on Fedora 28 + - #6505 (Cluster, PR): Fix clusterzonecheck if not connected + - #6498 (Configuration, PR): Fix regression with MatchAny false conditions on match/regex/cidr_match + - #6496 (Configuration): error with match and type matchany + * Documentation + - #6590 (DB IDO, Documentation, PR): Update workaround for custom vars + - #6572 (Documentation, PR): Add note about workaround for broken custom vars + * Support + - #6540 (Configuration): Evaluate a fixed config compiler commit order + - #6486 (Configuration): Configuration validation w/ ScheduledDowntimes performance decreased in 2.9 + - #6442 (Configuration): Error while evaluating "assign where match" expression: std::bad_cast +- Add icinga2-graphite.patch to have all tags as descriped in + upstream icingaweb2-module-graphite docs. + +------------------------------------------------------------------- +Tue Sep 11 10:26:13 UTC 2018 - [email protected] + +- remove rpmlint warnings: + - missing-dependency-to-logrotate + - obsolete-not-provided icinga2-libs + - permissions-missing-requires + +------------------------------------------------------------------- +Tue Sep 11 08:02:30 UTC 2018 - [email protected] + +- Incorporating upstream changes + * Handle licensing different between SUSE and RedHat + * Remove obsolete libs package + * Move service and config from common to main package + * Ensure consistent handling of fillupdir + Also see https://github.com/Icinga/rpm-icinga2/pull/5 + +------------------------------------------------------------------- Old: ---- v2.9.1.tar.gz New: ---- icinga2-graphite.patch v2.9.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ icinga2.spec ++++++ --- /var/tmp/diff_new_pack.pc4nwI/_old 2018-09-28 08:53:09.805749649 +0200 +++ /var/tmp/diff_new_pack.pc4nwI/_new 2018-09-28 08:53:09.809749644 +0200 @@ -55,7 +55,7 @@ %endif %if "%{_vendor}" == "suse" -%define plugindir %{_libexecdir}/nagios/plugins +%define plugindir %{_libexecdir}/nagios/plugins/ %define apachename apache2 %define apacheconfdir %{_sysconfdir}/apache2/conf.d %define apacheuser wwwrun @@ -82,16 +82,30 @@ Summary: Network monitoring application License: GPL-2.0-or-later Group: System/Monitoring +%if "%{_vendor}" == "suse" +%else +%endif # suse Name: icinga2 -Version: 2.9.1 +Version: 2.9.2 Release: %{revision}%{?dist} Url: https://www.icinga.com/ Source: https://github.com/Icinga/%{name}/archive/v%{version}.tar.gz Source1: icinga2-rpmlintrc +%if "%{_vendor}" == "suse" +# PATCH-FEATURE-OPENSUSE ecsos -- insert missing graphite tags as descriped in icingaweb2-module-graphite docs. +Patch0: icinga2-graphite.patch +%endif BuildRoot: %{_tmppath}/%{name}-%{version}-build +%if "%{_vendor}" == "suse" +PreReq: permissions +Requires: logrotate +%endif Requires: %{name}-bin = %{version}-%{release} +Requires: %{name}-common = %{version}-%{release} + +Conflicts: %{name}-common < %{version}-%{release} %description Meta package for Icinga 2 Core, DB IDO and Web. @@ -100,6 +114,8 @@ Summary: Icinga 2 binaries and libraries Group: System/Monitoring +Requires: %{name}-bin = %{version}-%{release} + %if "%{_vendor}" == "suse" Provides: monitoring_daemon Recommends: monitoring-plugins @@ -160,7 +176,9 @@ Requires: systemd %endif -Requires: %{name}-libs = %{version}-%{release} +Obsoletes: %{name}-libs < %{version} +Provides: %{name}-libs = %{version} +Conflicts: %{name}-libs %description bin Icinga 2 is a general-purpose network monitoring application. @@ -206,15 +224,6 @@ This subpackage provides documentation for Icinga 2. -%package libs -Summary: Libraries for Icinga 2 -Group: System/Libraries -Requires: %{name}-common = %{version}-%{release} - -%description libs -This subpackage provides the internal libraries for the daemon. - - %package ido-mysql Summary: IDO MySQL database backend for Icinga 2 Group: System/Monitoring @@ -228,7 +237,7 @@ BuildRequires: mysql-devel %endif #suse -Requires: %{name} = %{version}-%{release} +Requires: %{name}-bin = %{version}-%{release} %description ido-mysql Icinga 2 IDO mysql database backend. Compatible with Icinga 1.x @@ -243,7 +252,7 @@ %else BuildRequires: postgresql-devel %endif -Requires: %{name} = %{version}-%{release} +Requires: %{name}-bin = %{version}-%{release} %description ido-pgsql Icinga 2 IDO PostgreSQL database backend. Compatible with Icinga 1.x @@ -259,7 +268,7 @@ BuildRequires: checkpolicy BuildRequires: hardlink BuildRequires: selinux-policy-devel -Requires: %{name} = %{version}-%{release} +Requires: %{name}-bin = %{version}-%{release} Requires(post): policycoreutils-python Requires(postun): policycoreutils-python @@ -294,6 +303,7 @@ # use absolute shebang instead of env on SUSE distributions %if "%{_vendor}" == "suse" find . -type f -name '*.sh' -exec sed -i -e 's|\/usr\/bin\/env bash|\/bin\/bash|g' {} \; +%patch0 -p1 %endif %build @@ -396,13 +406,8 @@ %else ln -sf ../../%{_initrddir}/%{name} "%{buildroot}%{_sbindir}/rc%{name}" %endif -%if ( 0%{?sle_version} >= 150000 && 0%{?is_opensuse} ) || 0%{?suse_version} > 1500 mkdir -p "%{buildroot}%{_fillupdir}/" mv "%{buildroot}%{_sysconfdir}/sysconfig/%{name}" "%{buildroot}%{_fillupdir}/sysconfig.%{name}" -%else -mkdir -p "%{buildroot}%{_localstatedir}/adm/fillup-templates/" -mv "%{buildroot}%{_sysconfdir}/sysconfig/%{name}" "%{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}" -%endif %endif %if 0%{?use_selinux} @@ -429,21 +434,17 @@ install -D -m 0644 tools/syntax/nano/%{name}.nanorc %{buildroot}%{_datadir}/nano/%{name}.nanorc -%pre common -getent group %{icinga_group} >/dev/null || %{_sbindir}/groupadd -r %{icinga_group} -getent group %{icingacmd_group} >/dev/null || %{_sbindir}/groupadd -r %{icingacmd_group} -getent passwd %{icinga_user} >/dev/null || %{_sbindir}/useradd -c "icinga" -s /sbin/nologin -r -d %{_localstatedir}/spool/%{name} -G %{icingacmd_group} -g %{icinga_group} %{icinga_user} - +%pre %if "%{_vendor}" == "suse" %if 0%{?use_systemd} %service_add_pre %{name}.service %endif -%verifyscript common +%verifyscript %verify_permissions -e %{_rundir}/%{name}/cmd %endif -%post common +%post # suse %if "%{_vendor}" == "suse" %if 0%{?suse_version} >= 1310 @@ -489,7 +490,36 @@ %endif # suse/rhel -%postun common +%preun +# suse +%if "%{_vendor}" == "suse" + +%if 0%{?use_systemd} + %service_del_preun %{name}.service +%else + %stop_on_removal %{name} +%endif + +exit 0 + +%else +# rhel + +%if 0%{?use_systemd} +%systemd_preun %{name}.service +%else +if [ "$1" = "0" ]; then + /sbin/service %{name} stop > /dev/null 2>&1 || : + /sbin/chkconfig --del %{name} || : +fi +%endif + +exit 0 + +%endif +# suse / rhel + +%postun # suse %if "%{_vendor}" == "suse" %if 0%{?use_systemd} @@ -520,37 +550,25 @@ exit 0 -%preun common -# suse -%if "%{_vendor}" == "suse" +%pre common +getent group %{icinga_group} >/dev/null || %{_sbindir}/groupadd -r %{icinga_group} +getent group %{icingacmd_group} >/dev/null || %{_sbindir}/groupadd -r %{icingacmd_group} +getent passwd %{icinga_user} >/dev/null || %{_sbindir}/useradd -c "icinga" -s /sbin/nologin -r -d %{_localstatedir}/spool/%{name} -G %{icingacmd_group} -g %{icinga_group} %{icinga_user} -%if 0%{?use_systemd} - %service_del_preun %{name}.service -%else - %stop_on_removal %{name} +%if "%{_vendor}" == "suse" +%verifyscript common +%verify_permissions -e %{_rundir}/%{name}/cmd %endif -exit 0 - -%else -# rhel - -%if 0%{?use_systemd} -%systemd_preun %{name}.service -%else -if [ "$1" = "0" ]; then - /sbin/service %{name} stop > /dev/null 2>&1 || : - /sbin/chkconfig --del %{name} || : -fi +%post common +%if "%{_vendor}" == "suse" +%if 0%{?suse_version} >= 1310 +%set_permissions %{_rundir}/%{name}/cmd %endif - -exit 0 - %endif -# suse / rhel %post ido-mysql -if [ ${1:-0} -eq 1 ] +if [ ${1:-0} -eq 1 ] && [ -e %{_sysconfdir}/%{name}/features-enabled/ido-mysql.conf ] then # initial installation, enable ido-mysql feature ln -sf ../features-available/ido-mysql.conf %{_sysconfdir}/%{name}/features-enabled/ido-mysql.conf @@ -567,7 +585,7 @@ exit 0 %post ido-pgsql -if [ ${1:-0} -eq 1 ] +if [ ${1:-0} -eq 1 ] && [ -e %{_sysconfdir}/%{name}/features-enabled/ido-pgsql.conf ] then # initial installation, enable ido-pgsql feature ln -sf ../features-available/ido-pgsql.conf %{_sysconfdir}/%{name}/features-enabled/ido-pgsql.conf @@ -610,30 +628,8 @@ %defattr(-,root,root,-) %doc COPYING -%files bin -%defattr(-,root,root,-) -%doc COPYING README.md NEWS AUTHORS CHANGELOG.md -%{_sbindir}/%{name} -%dir %{_libdir}/%{name}/sbin -%{_libdir}/%{name}/sbin/%{name} -%{plugindir}/check_nscp_api -%{_datadir}/%{name} -%exclude %{_datadir}/%{name}/include -%{_mandir}/man8/%{name}.8.gz - -%files libs -%defattr(-,root,root,-) -%doc COPYING README.md NEWS AUTHORS CHANGELOG.md -%exclude %{_libdir}/%{name}/libmysql_shim* -%exclude %{_libdir}/%{name}/libpgsql_shim* -%dir %{_libdir}/%{name} -%{_libdir}/%{name}/*.so* - -%files common -%defattr(-,root,root,-) -%doc COPYING README.md NEWS AUTHORS CHANGELOG.md tools/syntax %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} -%{_sysconfdir}/bash_completion.d/%{name} + %if 0%{?use_systemd} %attr(644,root,root) %{_unitdir}/%{name}.service %if 0%{?configure_systemd_limits} @@ -650,14 +646,17 @@ %endif %if "%{_vendor}" == "suse" %{_sbindir}/rc%{name} -%if ( 0%{?sle_version} >= 150000 && 0%{?is_opensuse} ) || 0%{?suse_version} > 1500 %{_fillupdir}/sysconfig.%{name} %else -%{_localstatedir}/adm/fillup-templates/sysconfig.%{name} -%endif -%else %config(noreplace) %{_sysconfdir}/sysconfig/%{name} %endif + +%{_sbindir}/%{name} + +%dir %{_libexecdir}/%{name} +%{_libexecdir}/%{name}/prepare-dirs +%{_libexecdir}/%{name}/safe-reload + %attr(0750,root,%{icinga_group}) %dir %{_sysconfdir}/%{name} %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-available @@ -672,9 +671,7 @@ %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/*.conf %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/zones.d/* %config(noreplace) %{_sysconfdir}/%{name}/scripts/* -%dir %{_libexecdir}/%{name} -%{_libexecdir}/%{name}/prepare-dirs -%{_libexecdir}/%{name}/safe-reload + %attr(0750,%{icinga_user},%{icingacmd_group}) %{_localstatedir}/cache/%{name} %attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name} %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}/crash @@ -686,6 +683,22 @@ %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name} %attr(0770,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/perfdata %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/tmp + +%files bin +%defattr(-,root,root,-) +%doc COPYING README.md NEWS AUTHORS CHANGELOG.md +%dir %{_libdir}/%{name} +%dir %{_libdir}/%{name}/sbin +%{_libdir}/%{name}/sbin/%{name} +%{plugindir}/check_nscp_api +%{_datadir}/%{name} +%exclude %{_datadir}/%{name}/include +%{_mandir}/man8/%{name}.8.gz + +%files common +%defattr(-,root,root,-) +%doc COPYING README.md NEWS AUTHORS CHANGELOG.md tools/syntax +%{_sysconfdir}/bash_completion.d/%{name} %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_datadir}/%{name}/include %{_datadir}/%{name}/include/* ++++++ icinga2-graphite.patch ++++++ diff -Pdpru icinga2-2.9.1.orig/etc/icinga2/features-available/graphite.conf icinga2-2.9.1/etc/icinga2/features-available/graphite.conf --- icinga2-2.9.1.orig/etc/icinga2/features-available/graphite.conf 2018-07-24 12:48:12.000000000 +0200 +++ icinga2-2.9.1/etc/icinga2/features-available/graphite.conf 2018-09-26 11:50:37.417701228 +0200 @@ -3,7 +3,10 @@ * performance data to a graphite tcp socket. */ +library "perfdata" + object GraphiteWriter "graphite" { //host = "127.0.0.1" //port = 2003 + //enable_send_thresholds = true } ++++++ v2.9.1.tar.gz -> v2.9.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/icinga2-2.9.1/AUTHORS new/icinga2-2.9.2/AUTHORS --- old/icinga2-2.9.1/AUTHORS 2018-07-24 12:48:12.000000000 +0200 +++ new/icinga2-2.9.2/AUTHORS 2018-09-25 17:29:23.000000000 +0200 @@ -31,6 +31,7 @@ Christian Lehmann <[email protected]> Christian Loos <[email protected]> Christian Schmidt <[email protected]> +Christopher Schirner <[email protected]> Claudio Bilotta <[email protected]> Claudio Kuenzler <[email protected]> Conrad Clement <[email protected]> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/icinga2-2.9.1/CHANGELOG.md new/icinga2-2.9.2/CHANGELOG.md --- old/icinga2-2.9.1/CHANGELOG.md 2018-07-24 12:48:12.000000000 +0200 +++ new/icinga2-2.9.2/CHANGELOG.md 2018-09-25 17:29:23.000000000 +0200 @@ -1,5 +1,34 @@ # Icinga 2.x CHANGELOG +## 2.9.2 (2018-09-26) + +### Enhancement + +* [#6602](https://github.com/icinga/icinga2/issues/6602) (API, Cluster, PR): Improve TLS handshake exception logging +* [#6568](https://github.com/icinga/icinga2/issues/6568) (Configuration, PR): Ensure that config object types are committed in dependent load order +* [#6497](https://github.com/icinga/icinga2/issues/6497) (Configuration, PR): Improve error logging for match/regex/cidr\_match functions and unsupported dictionary usage + +### Bug + +* [#6596](https://github.com/icinga/icinga2/issues/6596) (Crash, PR): Fix crash on API queries with Fedora 28 hardening and GCC 8 +* [#6581](https://github.com/icinga/icinga2/issues/6581) (Configuration, PR): Shuffle items before config validation +* [#6569](https://github.com/icinga/icinga2/issues/6569) (DB IDO): Custom Vars not updated after upgrade +* [#6533](https://github.com/icinga/icinga2/issues/6533) (Crash): Icinga2 crashes after using some api-commands on Fedora 28 +* [#6505](https://github.com/icinga/icinga2/issues/6505) (Cluster, PR): Fix clusterzonecheck if not connected +* [#6498](https://github.com/icinga/icinga2/issues/6498) (Configuration, PR): Fix regression with MatchAny false conditions on match/regex/cidr\_match +* [#6496](https://github.com/icinga/icinga2/issues/6496) (Configuration): error with match and type matchany + +### Documentation + +* [#6590](https://github.com/icinga/icinga2/issues/6590) (DB IDO, Documentation, PR): Update workaround for custom vars +* [#6572](https://github.com/icinga/icinga2/issues/6572) (Documentation, PR): Add note about workaround for broken custom vars + +### Support + +* [#6540](https://github.com/icinga/icinga2/issues/6540) (Configuration): Evaluate a fixed config compiler commit order +* [#6486](https://github.com/icinga/icinga2/issues/6486) (Configuration): Configuration validation w/ ScheduledDowntimes performance decreased in 2.9 +* [#6442](https://github.com/icinga/icinga2/issues/6442) (Configuration): Error while evaluating "assign where match" expression: std::bad\_cast + ## 2.9.1 (2018-07-24) ### Bug diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/icinga2-2.9.1/RELEASE.md new/icinga2-2.9.2/RELEASE.md --- old/icinga2-2.9.1/RELEASE.md 2018-07-24 12:48:12.000000000 +0200 +++ new/icinga2-2.9.2/RELEASE.md 2018-09-25 17:29:23.000000000 +0200 @@ -26,7 +26,7 @@ Specify the release version. ``` -VERSION=2.9.0 +VERSION=2.9.2 ``` Add your signing key to your Git configuration file, if not already there. @@ -60,10 +60,11 @@ ## Version <a id="version"></a> -Update the version in the version file: +Update the version: ``` sed -i "s/Version: .*/Version: $VERSION/g" VERSION +sed -i "s/VERSION=.*/VERSION=$VERSION/g" RELEASE.md ``` ## Changelog <a id="changelog"></a> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/icinga2-2.9.1/VERSION new/icinga2-2.9.2/VERSION --- old/icinga2-2.9.1/VERSION 2018-07-24 12:48:12.000000000 +0200 +++ new/icinga2-2.9.2/VERSION 2018-09-25 17:29:23.000000000 +0200 @@ -1,2 +1,2 @@ -Version: 2.9.1 +Version: 2.9.2 Revision: 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/icinga2-2.9.1/doc/16-upgrading-icinga-2.md new/icinga2-2.9.2/doc/16-upgrading-icinga-2.md --- old/icinga2-2.9.1/doc/16-upgrading-icinga-2.md 2018-07-24 12:48:12.000000000 +0200 +++ new/icinga2-2.9.2/doc/16-upgrading-icinga-2.md 2018-09-25 17:29:23.000000000 +0200 @@ -97,6 +97,24 @@ This is reflected in generating names for e.g. API stage names. Previously it was a handcrafted mix of local FQDN, timestamps and random numbers. +### Custom Vars not updating <a id="upgrading-to-2-9-custom-vars-not-updating"></a> + +A rare issue preventing the custom vars of objects created prior to 2.9.0 being updated when changed may occur. To +remedy this, truncate the customvar tables and restart Icinga 2. The following is an example of how to do this with mysql: + +``` +$ mysql -uroot -picinga icinga +MariaDB [icinga]> truncate icinga_customvariables; +Query OK, 0 rows affected (0.05 sec) +MariaDB [icinga]> truncate icinga_customvariablestatus; +Query OK, 0 rows affected (0.03 sec) +MariaDB [icinga]> exit +Bye +$ sudo systemctl restart icinga2 +``` + +Custom vars should now stay up to date. + ## Upgrading to v2.8.2 <a id="upgrading-to-2-8-2"></a> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/icinga2-2.9.1/lib/base/scriptutils.cpp new/icinga2-2.9.2/lib/base/scriptutils.cpp --- old/icinga2-2.9.1/lib/base/scriptutils.cpp 2018-07-24 12:48:12.000000000 +0200 +++ new/icinga2-2.9.2/lib/base/scriptutils.cpp 2018-09-25 17:29:23.000000000 +0200 @@ -108,10 +108,14 @@ bool ScriptUtils::Regex(const std::vector<Value>& args) { if (args.size() < 2) - BOOST_THROW_EXCEPTION(std::invalid_argument("Regular expression and text must be specified.")); + BOOST_THROW_EXCEPTION(std::invalid_argument("Regular expression and text must be specified for regex().")); String pattern = args[0]; const Value& argTexts = args[1]; + + if (argTexts.IsObjectType<Dictionary>()) + BOOST_THROW_EXCEPTION(std::invalid_argument("Dictionaries are not supported by regex().")); + MatchType mode; if (args.size() > 2) @@ -147,7 +151,8 @@ return false; } - return true; + /* MatchAny: Nothing matched. MatchAll: Everything matched. */ + return mode == MatchAll; } else { String text = argTexts; boost::smatch what; @@ -158,10 +163,14 @@ bool ScriptUtils::Match(const std::vector<Value>& args) { if (args.size() < 2) - BOOST_THROW_EXCEPTION(std::invalid_argument("Pattern and text must be specified.")); + BOOST_THROW_EXCEPTION(std::invalid_argument("Pattern and text must be specified for match().")); String pattern = args[0]; const Value& argTexts = args[1]; + + if (argTexts.IsObjectType<Dictionary>()) + BOOST_THROW_EXCEPTION(std::invalid_argument("Dictionaries are not supported by match().")); + MatchType mode; if (args.size() > 2) @@ -189,7 +198,8 @@ return false; } - return true; + /* MatchAny: Nothing matched. MatchAll: Everything matched. */ + return mode == MatchAll; } else { String text = argTexts; return Utility::Match(pattern, argTexts); @@ -199,10 +209,14 @@ bool ScriptUtils::CidrMatch(const std::vector<Value>& args) { if (args.size() < 2) - BOOST_THROW_EXCEPTION(std::invalid_argument("CIDR and IP address must be specified.")); + BOOST_THROW_EXCEPTION(std::invalid_argument("CIDR and IP address must be specified for cidr_match().")); String pattern = args[0]; const Value& argIps = args[1]; + + if (argIps.IsObjectType<Dictionary>()) + BOOST_THROW_EXCEPTION(std::invalid_argument("Dictionaries are not supported by cidr_match().")); + MatchType mode; if (args.size() > 2) @@ -230,7 +244,8 @@ return false; } - return true; + /* MatchAny: Nothing matched. MatchAll: Everything matched. */ + return mode == MatchAll; } else { String ip = argIps; return Utility::CidrMatch(pattern, ip); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/icinga2-2.9.1/lib/config/configitem.cpp new/icinga2-2.9.2/lib/config/configitem.cpp --- old/icinga2-2.9.1/lib/config/configitem.cpp 2018-07-24 12:48:12.000000000 +0200 +++ new/icinga2-2.9.2/lib/config/configitem.cpp 2018-09-25 17:29:23.000000000 +0200 @@ -38,6 +38,8 @@ #include "base/function.hpp" #include <sstream> #include <fstream> +#include <algorithm> +#include <random> using namespace icinga; @@ -428,26 +430,77 @@ if (items.empty()) return true; - for (const auto& ip : items) - newItems.push_back(ip.first); - - upq.ParallelFor(items, [](const ItemPair& ip) { - ip.first->Commit(ip.second); - }); + // Shuffle all items to evenly distribute them over the threads of the workqueue. This increases perfomance + // noticably in environments with lots of objects and available threads. + std::shuffle(std::begin(items), std::end(items), std::default_random_engine {}); - upq.Join(); +#ifdef I2_DEBUG + Log(LogDebug, "configitem") + << "Committing " << items.size() << " new items."; +#endif /* I2_DEBUG */ - if (upq.HasExceptions()) - return false; + for (const auto& ip : items) + newItems.push_back(ip.first); std::set<Type::Ptr> types; + std::set<Type::Ptr> completed_types; for (const Type::Ptr& type : Type::GetAllTypes()) { if (ConfigObject::TypeInstance->IsAssignableFrom(type)) types.insert(type); } - std::set<Type::Ptr> completed_types; + while (types.size() != completed_types.size()) { + for (const Type::Ptr& type : types) { + if (completed_types.find(type) != completed_types.end()) + continue; + + bool unresolved_dep = false; + + /* skip this type (for now) if there are unresolved load dependencies */ + for (const String& loadDep : type->GetLoadDependencies()) { + Type::Ptr pLoadDep = Type::GetByName(loadDep); + if (types.find(pLoadDep) != types.end() && completed_types.find(pLoadDep) == completed_types.end()) { + unresolved_dep = true; + break; + } + } + + if (unresolved_dep) + continue; + + int committed_items = 0; + upq.ParallelFor(items, [&type, &committed_items](const ItemPair& ip) { + const ConfigItem::Ptr& item = ip.first; + + if (item->m_Type != type) + return; + + ip.first->Commit(ip.second); + committed_items++; + }); + + upq.Join(); + + completed_types.insert(type); + +#ifdef I2_DEBUG + if (committed_items > 0) + Log(LogDebug, "configitem") + << "Committed " << committed_items << " items of type '" << type->GetName() << "'."; +#endif /* I2_DEBUG */ + + if (upq.HasExceptions()) + return false; + } + } + +#ifdef I2_DEBUG + Log(LogDebug, "configitem") + << "Committed " << items.size() << " items."; +#endif /* I2_DEBUG */ + + completed_types.clear(); while (types.size() != completed_types.size()) { for (const Type::Ptr& type : types) { @@ -468,7 +521,8 @@ if (unresolved_dep) continue; - upq.ParallelFor(items, [&type](const ItemPair& ip) { + int notified_items = 0; + upq.ParallelFor(items, [&type, ¬ified_items](const ItemPair& ip) { const ConfigItem::Ptr& item = ip.first; if (!item->m_Object || item->m_Type != type) @@ -476,6 +530,7 @@ try { item->m_Object->OnAllConfigLoaded(); + notified_items++; } catch (const std::exception& ex) { if (!item->m_IgnoreOnError) throw; @@ -496,11 +551,18 @@ upq.Join(); +#ifdef I2_DEBUG + if (notified_items > 0) + Log(LogDebug, "configitem") + << "Sent OnAllConfigLoaded to " << notified_items << " items of type '" << type->GetName() << "'."; +#endif /* I2_DEBUG */ + if (upq.HasExceptions()) return false; + notified_items = 0; for (const String& loadDep : type->GetLoadDependencies()) { - upq.ParallelFor(items, [loadDep, &type](const ItemPair& ip) { + upq.ParallelFor(items, [loadDep, &type, ¬ified_items](const ItemPair& ip) { const ConfigItem::Ptr& item = ip.first; if (!item->m_Object || item->m_Type->GetName() != loadDep) @@ -508,14 +570,22 @@ ActivationScope ascope(item->m_ActivationContext); item->m_Object->CreateChildObjects(type); + notified_items++; }); } upq.Join(); +#ifdef I2_DEBUG + if (notified_items > 0) + Log(LogDebug, "configitem") + << "Sent CreateChildObjects to " << notified_items << " items of type '" << type->GetName() << "'."; +#endif /* I2_DEBUG */ + if (upq.HasExceptions()) return false; + // Make sure to activate any additionally generated items if (!CommitNewItems(context, upq, newItems)) return false; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/icinga2-2.9.1/lib/methods/clusterzonechecktask.cpp new/icinga2-2.9.2/lib/methods/clusterzonechecktask.cpp --- old/icinga2-2.9.1/lib/methods/clusterzonechecktask.cpp 2018-07-24 12:48:12.000000000 +0200 +++ new/icinga2-2.9.2/lib/methods/clusterzonechecktask.cpp 2018-09-25 17:29:23.000000000 +0200 @@ -122,23 +122,23 @@ bytesReceivedPerSecond += endpoint->GetBytesReceivedPerSecond(); } - if (!connected) { - cr->SetState(ServiceCritical); - cr->SetOutput("Zone '" + zoneName + "' is not connected. Log lag: " + Utility::FormatDuration(zoneLag)); - } else { + if (connected) { cr->SetState(ServiceOK); cr->SetOutput("Zone '" + zoneName + "' is connected. Log lag: " + Utility::FormatDuration(zoneLag)); - } - /* Check whether the thresholds have been resolved and compare them */ - if (missingLagCritical.IsEmpty() && zoneLag > lagCritical) { + /* Check whether the thresholds have been resolved and compare them */ + if (missingLagCritical.IsEmpty() && zoneLag > lagCritical) { + cr->SetState(ServiceCritical); + cr->SetOutput("Zone '" + zoneName + "' is connected. Log lag: " + Utility::FormatDuration(zoneLag) + + " greater than critical threshold: " + Utility::FormatDuration(lagCritical)); + } else if (missingLagWarning.IsEmpty() && zoneLag > lagWarning) { + cr->SetState(ServiceWarning); + cr->SetOutput("Zone '" + zoneName + "' is connected. Log lag: " + Utility::FormatDuration(zoneLag) + + " greater than warning threshold: " + Utility::FormatDuration(lagWarning)); + } + } else { cr->SetState(ServiceCritical); - cr->SetOutput("Zone '" + zoneName + "' is connected. Log lag: " + Utility::FormatDuration(zoneLag) - + " greater than critical threshold: " + Utility::FormatDuration(lagCritical)); - } else if (missingLagWarning.IsEmpty() && zoneLag > lagWarning) { - cr->SetState(ServiceWarning); - cr->SetOutput("Zone '" + zoneName + "' is connected. Log lag: " + Utility::FormatDuration(zoneLag) - + " greater than warning threshold: " + Utility::FormatDuration(lagWarning)); + cr->SetOutput("Zone '" + zoneName + "' is not connected. Log lag: " + Utility::FormatDuration(zoneLag)); } cr->SetPerformanceData(new Array({ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/icinga2-2.9.1/lib/perfdata/elasticsearchwriter.cpp new/icinga2-2.9.2/lib/perfdata/elasticsearchwriter.cpp --- old/icinga2-2.9.1/lib/perfdata/elasticsearchwriter.cpp 2018-07-24 12:48:12.000000000 +0200 +++ new/icinga2-2.9.2/lib/perfdata/elasticsearchwriter.cpp 2018-09-25 17:29:23.000000000 +0200 @@ -434,7 +434,7 @@ stream = Connect(); } catch (const std::exception& ex) { Log(LogWarning, "ElasticsearchWriter") - << "Flush failed, cannot connect to Elasticsearch."; + << "Flush failed, cannot connect to Elasticsearch: " << DiagnosticInformation(ex, false); return; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/icinga2-2.9.1/lib/perfdata/influxdbwriter.cpp new/icinga2-2.9.2/lib/perfdata/influxdbwriter.cpp --- old/icinga2-2.9.1/lib/perfdata/influxdbwriter.cpp 2018-07-24 12:48:12.000000000 +0200 +++ new/icinga2-2.9.2/lib/perfdata/influxdbwriter.cpp 2018-09-25 17:29:23.000000000 +0200 @@ -425,7 +425,7 @@ stream = Connect(); } catch (const std::exception& ex) { Log(LogWarning, "InfluxDbWriter") - << "Flush failed, cannot connect to InfluxDB."; + << "Flush failed, cannot connect to InfluxDB: " << DiagnosticInformation(ex, false); return; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/icinga2-2.9.1/lib/remote/apilistener.cpp new/icinga2-2.9.2/lib/remote/apilistener.cpp --- old/icinga2-2.9.1/lib/remote/apilistener.cpp 2018-07-24 12:48:12.000000000 +0200 +++ new/icinga2-2.9.2/lib/remote/apilistener.cpp 2018-09-25 17:29:23.000000000 +0200 @@ -454,9 +454,9 @@ try { tlsStream->Handshake(); - } catch (const std::exception&) { + } catch (const std::exception& ex) { Log(LogCritical, "ApiListener") - << "Client TLS handshake failed (" << conninfo << ")"; + << "Client TLS handshake failed (" << conninfo << "): " << DiagnosticInformation(ex, false); tlsStream->Close(); return; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/icinga2-2.9.1/lib/remote/filterutility.cpp new/icinga2-2.9.2/lib/remote/filterutility.cpp --- old/icinga2-2.9.1/lib/remote/filterutility.cpp 2018-07-24 12:48:12.000000000 +0200 +++ new/icinga2-2.9.2/lib/remote/filterutility.cpp 2018-09-25 17:29:23.000000000 +0200 @@ -127,7 +127,7 @@ ScriptFrame& frame, Expression *ufilter, std::vector<Value>& result, const String& variableName, const Object::Ptr& target) { if (FilterUtility::EvaluateFilter(permissionFrame, permissionFilter, target, variableName) && FilterUtility::EvaluateFilter(frame, ufilter, target, variableName)) - result.emplace_back(target); + result.emplace_back(std::move(target)); } void FilterUtility::CheckPermission(const ApiUser::Ptr& user, const String& permission, Expression **permissionFilter) @@ -206,7 +206,7 @@ if (attr == "type") attr = "name"; - if (query->Contains(attr)) { + if (query && query->Contains(attr)) { String name = HttpUtility::GetLastParameter(query, attr); Object::Ptr target = provider->GetTargetByName(type, name); @@ -219,7 +219,7 @@ attr = provider->GetPluralName(type); boost::algorithm::to_lower(attr); - if (query->Contains(attr)) { + if (query && query->Contains(attr)) { Array::Ptr names = query->Get(attr); if (names) { ObjectLock olock(names); @@ -235,7 +235,7 @@ } } - if (query->Contains("filter") || result.empty()) { + if ((query && query->Contains("filter")) || result.empty()) { if (!query->Contains("type")) BOOST_THROW_EXCEPTION(std::invalid_argument("Type must be specified when using a filter.")); @@ -251,26 +251,31 @@ frame.Sandboxed = true; Dictionary::Ptr uvars = new Dictionary(); - std::unique_ptr<Expression> ufilter; - if (query->Contains("filter")) { String filter = HttpUtility::GetLastParameter(query, "filter"); - ufilter = ConfigCompiler::CompileText("<API query>", filter); - } + std::unique_ptr<Expression> ufilter = ConfigCompiler::CompileText("<API query>", filter); - Dictionary::Ptr filter_vars = query->Get("filter_vars"); - if (filter_vars) { - ObjectLock olock(filter_vars); - for (const Dictionary::Pair& kv : filter_vars) { - uvars->Set(kv.first, kv.second); + Dictionary::Ptr filter_vars = query->Get("filter_vars"); + if (filter_vars) { + ObjectLock olock(filter_vars); + for (const Dictionary::Pair& kv : filter_vars) { + uvars->Set(kv.first, kv.second); + } } - } - frame.Self = uvars; + frame.Self = uvars; - provider->FindTargets(type, std::bind(&FilteredAddTarget, - std::ref(permissionFrame), permissionFilter, - std::ref(frame), &*ufilter, std::ref(result), variableName, _1)); + provider->FindTargets(type, std::bind(&FilteredAddTarget, + std::ref(permissionFrame), permissionFilter, + std::ref(frame), &*ufilter, std::ref(result), variableName, _1)); + } else { + /* Ensure to pass a nullptr as filter expression. + * GCC 8.1.1 on F28 causes problems, see GH #6533. + */ + provider->FindTargets(type, std::bind(&FilteredAddTarget, + std::ref(permissionFrame), permissionFilter, + std::ref(frame), nullptr, std::ref(result), variableName, _1)); + } } return result; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/icinga2-2.9.1/lib/remote/pkiutility.cpp new/icinga2-2.9.2/lib/remote/pkiutility.cpp --- old/icinga2-2.9.1/lib/remote/pkiutility.cpp 2018-07-24 12:48:12.000000000 +0200 +++ new/icinga2-2.9.2/lib/remote/pkiutility.cpp 2018-09-25 17:29:23.000000000 +0200 @@ -187,8 +187,9 @@ try { stream->Handshake(); - } catch (const std::exception&) { - Log(LogCritical, "cli", "Client TLS handshake failed."); + } catch (const std::exception& ex) { + Log(LogCritical, "cli") + << "Client TLS handshake failed: " << DiagnosticInformation(ex, false); return 1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/icinga2-2.9.1/lib/remote/pkiutility.hpp new/icinga2-2.9.2/lib/remote/pkiutility.hpp --- old/icinga2-2.9.1/lib/remote/pkiutility.hpp 2018-07-24 12:48:12.000000000 +0200 +++ new/icinga2-2.9.2/lib/remote/pkiutility.hpp 2018-09-25 17:29:23.000000000 +0200 @@ -21,6 +21,7 @@ #define PKIUTILITY_H #include "remote/i2-remote.hpp" +#include "base/exception.hpp" #include "base/dictionary.hpp" #include "base/string.hpp" #include <openssl/x509v3.h>
