[icinga-checkins] icinga.org: icingaweb2-module-director/master: AssignRenderer: support FilterMatchNot

git at icinga.org git at icinga.org
Fri May 20 10:57:15 CEST 2016


Module: icingaweb2-module-director
Branch: master
Commit: 8c54dcab81f5385aa9e8ec8a1916bc55f0742f14
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=8c54dcab81f5385aa9e8ec8a1916bc55f0742f14

Author: Thomas Gelf <thomas at gelf.net>
Date:   Fri May 20 10:56:58 2016 +0200

AssignRenderer: support FilterMatchNot

---

 library/Director/IcingaConfig/AssignRenderer.php |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/library/Director/IcingaConfig/AssignRenderer.php b/library/Director/IcingaConfig/AssignRenderer.php
index 89202a1..39baaee 100644
--- a/library/Director/IcingaConfig/AssignRenderer.php
+++ b/library/Director/IcingaConfig/AssignRenderer.php
@@ -12,6 +12,7 @@ use Icinga\Data\Filter\FilterEqual;
 use Icinga\Data\Filter\FilterGreaterThan;
 use Icinga\Data\Filter\FilterLessThan;
 use Icinga\Data\Filter\FilterMatch;
+use Icinga\Data\Filter\FilterMatchNot;
 use Icinga\Data\Filter\FilterNotEqual;
 use Icinga\Exception\QueryException;
 
@@ -79,6 +80,21 @@ class AssignRenderer
                 );
             }
 
+        } elseif ($filter instanceof FilterMatchNot) {
+            if (strpos($expression, '*') === false) {
+                return sprintf(
+                    '%s != %s',
+                    $column,
+                    $expression
+                );
+            } else {
+                return sprintf(
+                    '! match(%s, %s)',
+                    $expression,
+                    $column
+                );
+            }
+
         } elseif ($filter instanceof FilterNotEqual) {
                 return sprintf(
                     '%s != %s',



More information about the icinga-checkins mailing list