Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package icingaweb2-module-director for 
openSUSE:Factory checked in at 2022-10-08 01:25:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/icingaweb2-module-director (Old)
 and      /work/SRC/openSUSE:Factory/.icingaweb2-module-director.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "icingaweb2-module-director"

Sat Oct  8 01:25:50 2022 rev:18 rq:1008773 version:1.10.1

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/icingaweb2-module-director/icingaweb2-module-director.changes
    2022-09-22 14:50:09.598472013 +0200
+++ 
/work/SRC/openSUSE:Factory/.icingaweb2-module-director.new.2275/icingaweb2-module-director.changes
  2022-10-08 01:26:20.362383008 +0200
@@ -1,0 +2,18 @@
+Fri Oct  7 12:15:19 UTC 2022 - ecsos <ec...@opensuse.org>
+
+- Update to 1.10.1
+  * Import and Sync
+    - FIX: sync lower-cased all object names since v1.10 (#2608)
+    - FIX: sync for Datalist entries has been fixed (#2618)
+    - FIX: Sync now applied NULL values with merge policy (#2623)
+    - FIX: Sync created Sync History entries for every preview (#2632)
+    - FIX: "Purge" stopped working for Sync (#2627)
+  * UI
+    - FIX: "Modify" Services via the monitoring module (#2615, #2619)
+  * Configuration Baskets
+    - FIX: restore Import/Sync/Job when exported with v1.10 (#2620)
+    - FIX: restoring Job with ImportSource or SyncRule (#2528)
+  * Database Schema
+    - FIX: new DB schema failed due to duplicate line in SQL statement (#2609)
+
+-------------------------------------------------------------------

Old:
----
  icingaweb2-module-director-1.10.0.tar.gz

New:
----
  icingaweb2-module-director-1.10.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ icingaweb2-module-director.spec ++++++
--- /var/tmp/diff_new_pack.8eIjSQ/_old  2022-10-08 01:26:22.058386898 +0200
+++ /var/tmp/diff_new_pack.8eIjSQ/_new  2022-10-08 01:26:22.062386907 +0200
@@ -19,7 +19,7 @@
 # See also http://en.opensuse.org/openSUSE:Specfile_guidelines
 
 Name:           icingaweb2-module-director
-Version:        1.10.0
+Version:        1.10.1
 Release:        0
 Summary:        Config module for Icinga Web 2
 License:        GPL-2.0-or-later
@@ -36,8 +36,8 @@
 Requires:       icingaweb2-module-ipl >= 0.5.0
 Requires:       icingaweb2-module-reactbundle >= 0.9.0
 Requires:       php >= 7.3
-Requires:       php-iconv
 Requires:       php-curl
+Requires:       php-iconv
 Requires:       php-pcntl
 Requires:       php-posix
 Requires:       php-sockets

++++++ icingaweb2-module-director-1.10.0.tar.gz -> 
icingaweb2-module-director-1.10.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.10.0/application/controllers/HostController.php
 
new/icingaweb2-module-director-1.10.1/application/controllers/HostController.php
--- 
old/icingaweb2-module-director-1.10.0/application/controllers/HostController.php
    2022-09-21 11:51:18.000000000 +0200
+++ 
new/icingaweb2-module-director-1.10.1/application/controllers/HostController.php
    2022-10-07 12:59:52.000000000 +0200
@@ -211,7 +211,8 @@
             ->setAuth($this->Auth())
             ->setHost($host)
             ->setBranch($branch)
-            ->setTitle($this->translate('Individual Service objects'));
+            ->setTitle($this->translate('Individual Service objects'))
+            ->removeQueryLimit();
 
         if (count($table)) {
             $content->add($table);
@@ -225,7 +226,9 @@
                 ->setAuth($this->Auth())
                 ->setBranch($branch)
                 ->setHost($parent)
-                ->setInheritedBy($host);
+                ->setInheritedBy($host)
+                ->removeQueryLimit();
+
             if (count($table)) {
                 $content->add(
                     $table->setTitle(sprintf(
@@ -253,6 +256,7 @@
                     ->setBranch($branch)
                     ->setAffectedHost($host)
                     ->setTitle($title)
+                    ->removeQueryLimit()
             );
         }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.10.0/doc/02-Installation.md 
new/icingaweb2-module-director-1.10.1/doc/02-Installation.md
--- old/icingaweb2-module-director-1.10.0/doc/02-Installation.md        
2022-09-21 11:51:18.000000000 +0200
+++ new/icingaweb2-module-director-1.10.1/doc/02-Installation.md        
2022-10-07 12:59:52.000000000 +0200
@@ -96,7 +96,7 @@
 You might want to use a script as follows for this task:
 
 ```shell
-MODULE_VERSION="1.10.0"
+MODULE_VERSION="1.10.1"
 ICINGAWEB_MODULEPATH="/usr/share/icingaweb2/modules"
 REPO_URL="https://github.com/icinga/icingaweb2-module-director";
 TARGET_DIR="${ICINGAWEB_MODULEPATH}/director"
@@ -123,7 +123,7 @@
 It will be immediately ready for use:
 
 ```shell
-MODULE_VERSION="1.10.0"
+MODULE_VERSION="1.10.1"
 ICINGAWEB_MODULEPATH="/usr/share/icingaweb2/modules"
 REPO_URL="https://github.com/icinga/icingaweb2-module-director";
 TARGET_DIR="${ICINGAWEB_MODULEPATH}/director"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.10.0/doc/82-Changelog.md 
new/icingaweb2-module-director-1.10.1/doc/82-Changelog.md
--- old/icingaweb2-module-director-1.10.0/doc/82-Changelog.md   2022-09-21 
11:51:18.000000000 +0200
+++ new/icingaweb2-module-director-1.10.1/doc/82-Changelog.md   2022-10-07 
12:59:52.000000000 +0200
@@ -4,6 +4,42 @@
 Please make sure to always read our [Upgrading](05-Upgrading.md) documentation
 before switching to a new version.
 
+v1.10.1
+-------
+
+This is a minor bugfix release, addressing issues with modifying services via
+the monitoring module, Sync problems and a copy and paste error in the DB 
schema,
+which caused problems for fresh installations since v1.10.
+
+Please note that a long-standing issue for our Sync Rules has been fixed: with
+"merge" policy, NULL properties have been ignored for quite some time. This has
+now been fixed. If in doubt, please **preview** your Sync Rules to make sure,
+that they behave as expected.
+
+This release brings a small schema migration, cleaning up invalid Sync history
+entries. If in doubt, please create a [database 
backup](05-Upgrading.md#backup-first) first.
+
+### Fixed issues
+* You can find issues and feature requests related to this release on our
+  
[roadmap](https://github.com/Icinga/icingaweb2-module-director/milestone/30?closed=1)
+
+### Import and Sync
+* FIX: sync lower-cased all object names since v1.10 (#2608)
+* FIX: sync for Datalist entries has been fixed (#2618)
+* FIX: Sync now applied NULL values with merge policy (#2623)
+* FIX: Sync created Sync History entries for every preview (#2632)
+* FIX: "Purge" stopped working for Sync (#2627)
+
+### UI
+* FIX: "Modify" Services via the monitoring module (#2615, #2619)
+
+### Configuration Baskets
+* FIX: restore Import/Sync/Job when exported with v1.10 (#2620)
+* FIX: restoring Job with ImportSource or SyncRule (#2528)
+
+### Database Schema
+* FIX: new DB schema failed due to duplicate line in SQL statement (#2609)
+
 v1.10.0
 -------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.10.0/library/Director/Core/CoreApi.php 
new/icingaweb2-module-director-1.10.1/library/Director/Core/CoreApi.php
--- old/icingaweb2-module-director-1.10.0/library/Director/Core/CoreApi.php     
2022-09-21 11:51:18.000000000 +0200
+++ new/icingaweb2-module-director-1.10.1/library/Director/Core/CoreApi.php     
2022-10-07 12:59:52.000000000 +0200
@@ -47,8 +47,8 @@
     {
         $version = $this->getVersion();
 
-        if ($version === null || (version_compare($version, '2.8.2', '>=')
-            && version_compare($version, '2.10.2', '<'))
+        if ($version === null ||
+            ((version_compare($version, '2.8.2', '>=') && 
version_compare($version, '2.10.2', '<')))
         ) {
             $this->client->disconnect();
             $this->client->setKeepAlive(false);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.10.0/library/Director/CustomVariable/CustomVariables.php
 
new/icingaweb2-module-director-1.10.1/library/Director/CustomVariable/CustomVariables.php
--- 
old/icingaweb2-module-director-1.10.0/library/Director/CustomVariable/CustomVariables.php
   2022-09-21 11:51:18.000000000 +0200
+++ 
new/icingaweb2-module-director-1.10.1/library/Director/CustomVariable/CustomVariables.php
   2022-10-07 12:59:52.000000000 +0200
@@ -162,6 +162,7 @@
     protected function refreshIndex()
     {
         $this->idx = array();
+        ksort($this->vars);
         foreach ($this->vars as $name => $var) {
             if (! $var->hasBeenDeleted()) {
                 $this->idx[] = $name;
@@ -344,8 +345,7 @@
     {
         $out = '';
 
-        ksort($this->vars);
-        foreach ($this->vars as $key => $var) {
+        foreach ($this as $key => $var) {
             // TODO: ctype_alnum + underscore?
             $out .= $this->renderSingleVar($key, $var, $renderExpressions);
         }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.10.0/library/Director/Data/Db/DbObject.php 
new/icingaweb2-module-director-1.10.1/library/Director/Data/Db/DbObject.php
--- old/icingaweb2-module-director-1.10.0/library/Director/Data/Db/DbObject.php 
2022-09-21 11:51:18.000000000 +0200
+++ new/icingaweb2-module-director-1.10.1/library/Director/Data/Db/DbObject.php 
2022-10-07 12:59:52.000000000 +0200
@@ -371,9 +371,27 @@
         if ($value === $this->properties[$key]) {
             return $this;
         }
+        if ($key === 'id' || substr($key, -3) === '_id') {
+            if ((int) $value === (int) $this->properties[$key]) {
+                return $this;
+            }
+        }
+
+        if ($this->hasBeenLoadedFromDb()) {
+            if ($value === $this->loadedProperties[$key]) {
+                unset($this->modifiedProperties[$key]);
+                if (empty($this->modifiedProperties)) {
+                    $this->hasBeenModified = false;
+                }
+            } else {
+                $this->hasBeenModified = true;
+                $this->modifiedProperties[$key] = true;
+            }
+        } else {
+            $this->hasBeenModified = true;
+            $this->modifiedProperties[$key] = true;
+        }
 
-        $this->hasBeenModified = true;
-        $this->modifiedProperties[$key] = true;
         $this->properties[$key] = $value;
         return $this;
     }
@@ -474,6 +492,11 @@
         return array_keys($this->properties);
     }
 
+    public function getDefaultProperties()
+    {
+        return $this->defaultProperties;
+    }
+
     /**
      * Return all properties that changed since object creation
      *
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.10.0/library/Director/Data/Db/DbObjectStore.php
 
new/icingaweb2-module-director-1.10.1/library/Director/Data/Db/DbObjectStore.php
--- 
old/icingaweb2-module-director-1.10.0/library/Director/Data/Db/DbObjectStore.php
    2022-09-21 11:51:18.000000000 +0200
+++ 
new/icingaweb2-module-director-1.10.1/library/Director/Data/Db/DbObjectStore.php
    2022-10-07 12:59:52.000000000 +0200
@@ -64,7 +64,7 @@
     {
         $db = $this->connection->getDbAdapter();
         $class = DbObjectTypeRegistry::classByType($tableName);
-        $query = $db->select()->from($tableName)->order('uuid');
+        $query = $db->select()->from($tableName)->order($arrayIdx);
         $result = [];
         foreach ($db->fetchAll($query) as $row) {
             $result[$row->uuid] = $class::create((array) $row, 
$this->connection);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.10.0/library/Director/DirectorObject/Lookup/AppliedServiceInfo.php
 
new/icingaweb2-module-director-1.10.1/library/Director/DirectorObject/Lookup/AppliedServiceInfo.php
--- 
old/icingaweb2-module-director-1.10.0/library/Director/DirectorObject/Lookup/AppliedServiceInfo.php
 2022-09-21 11:51:18.000000000 +0200
+++ 
new/icingaweb2-module-director-1.10.1/library/Director/DirectorObject/Lookup/AppliedServiceInfo.php
 2022-10-07 12:59:52.000000000 +0200
@@ -7,6 +7,7 @@
 use Icinga\Module\Director\Db;
 use Icinga\Module\Director\Objects\HostApplyMatches;
 use Icinga\Module\Director\Objects\IcingaHost;
+use Ramsey\Uuid\Uuid;
 use Ramsey\Uuid\UuidInterface;
 
 /**
@@ -99,6 +100,7 @@
 
         $allRules = $db->fetchAll($query);
         foreach ($allRules as $rule) {
+            $rule->uuid = 
Uuid::fromBytes(Db\DbUtil::binaryResult($rule->uuid));
             $rule->filter = Filter::fromQueryString($rule->assign_filter);
         }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.10.0/library/Director/DirectorObject/Lookup/AppliedServiceSetServiceInfo.php
 
new/icingaweb2-module-director-1.10.1/library/Director/DirectorObject/Lookup/AppliedServiceSetServiceInfo.php
--- 
old/icingaweb2-module-director-1.10.0/library/Director/DirectorObject/Lookup/AppliedServiceSetServiceInfo.php
       2022-09-21 11:51:18.000000000 +0200
+++ 
new/icingaweb2-module-director-1.10.1/library/Director/DirectorObject/Lookup/AppliedServiceSetServiceInfo.php
       2022-10-07 12:59:52.000000000 +0200
@@ -7,6 +7,7 @@
 use Icinga\Module\Director\Db;
 use Icinga\Module\Director\Objects\HostApplyMatches;
 use Icinga\Module\Director\Objects\IcingaHost;
+use Ramsey\Uuid\Uuid;
 use Ramsey\Uuid\UuidInterface;
 
 /**
@@ -96,6 +97,7 @@
         $query = $db->select()
             ->from(['s' => 'icinga_service'], [
                 'id'            => 's.id',
+                'uuid'          => 'ss.uuid',
                 'name'          => 's.object_name',
                 'assign_filter' => 'ss.assign_filter',
                 'service_set_name' => 'ss.object_name',
@@ -116,6 +118,7 @@
 
         $allRules = $db->fetchAll($query);
         foreach ($allRules as $rule) {
+            $rule->uuid = 
Uuid::fromBytes(Db\DbUtil::binaryResult($rule->uuid));
             $rule->filter = Filter::fromQueryString($rule->assign_filter);
         }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.10.0/library/Director/Import/Sync.php 
new/icingaweb2-module-director-1.10.1/library/Director/Import/Sync.php
--- old/icingaweb2-module-director-1.10.0/library/Director/Import/Sync.php      
2022-09-21 11:51:18.000000000 +0200
+++ new/icingaweb2-module-director-1.10.1/library/Director/Import/Sync.php      
2022-10-07 12:59:52.000000000 +0200
@@ -10,6 +10,7 @@
 use Icinga\Module\Director\Data\Db\DbObjectStore;
 use Icinga\Module\Director\Data\Db\DbObjectTypeRegistry;
 use Icinga\Module\Director\Db;
+use Icinga\Module\Director\Db\Branch\BranchSupport;
 use Icinga\Module\Director\Db\Cache\PrefetchCache;
 use Icinga\Module\Director\Objects\HostGroupMembershipResolver;
 use Icinga\Module\Director\Objects\IcingaHost;
@@ -45,6 +46,9 @@
     /** @var IcingaObject[] Objects to work with */
     protected $objects;
 
+    /** @var array<mixed, array<int, string>> key => [property, property]*/
+    protected $setNull = [];
+
     /** @var bool Whether we already prepared your sync */
     protected $isPrepared = false;
 
@@ -406,8 +410,9 @@
         if ($this->rule->hasCombinedKey()) {
             $this->objects = [];
             $destinationKeyPattern = $this->rule->getDestinationKeyPattern();
-            if ($this->store) {
-                $objects = 
$this->store->loadAll(DbObjectTypeRegistry::tableNameByType($ruleObjectType));
+            $table = DbObjectTypeRegistry::tableNameByType($ruleObjectType);
+            if ($this->store && BranchSupport::existsForTableName($table)) {
+                $objects = $this->store->loadAll($table);
             } else {
                 $objects = IcingaObject::loadAllByType($ruleObjectType, 
$this->db);
             }
@@ -483,10 +488,12 @@
 
         foreach ($this->sources as $source) {
             $sourceId = $source->id;
+            $keyColumn = $source->get('key_column');
 
             foreach ($this->imported[$sourceId] as $key => $row) {
                 // Workaround: $a["10"] = "val"; -> array_keys($a) = [(int) 10]
                 $key = (string) $key;
+                $originalKey = $row->$keyColumn;
                 if ($this->usedLowerCasedKeys) {
                     $key = strtolower($key);
                 }
@@ -497,7 +504,7 @@
                     } else {
                         $props = [
                             'object_type' => 'object',
-                            'object_name' => $key
+                            'object_name' => $originalKey,
                         ];
                     }
 
@@ -509,7 +516,7 @@
                 }
 
                 $object = $objects[$key];
-                $this->prepareNewObject($row, $object, $sourceId);
+                $this->prepareNewObject($row, $object, $key, $sourceId);
             }
         }
 
@@ -523,7 +530,7 @@
      * @throws \Icinga\Exception\NotFoundError
      * @throws \Icinga\Module\Director\Exception\DuplicateKeyException
      */
-    protected function prepareNewObject($row, DbObject $object, $sourceId)
+    protected function prepareNewObject($row, DbObject $object, $objectKey, 
$sourceId)
     {
         foreach ($this->syncProperties as $propertyKey => $p) {
             if ($p->get('source_id') !== $sourceId) {
@@ -535,7 +542,6 @@
             }
 
             $prop = $p->get('destination_field');
-
             $val = SyncUtils::fillVariables($p->get('source_expression'), 
$row);
 
             if ($object instanceof IcingaObject) {
@@ -557,15 +563,26 @@
                             $this->wantArray($val)
                         );
                     } else {
-                        $object->vars()->$varName = $val;
+                        if ($val === null) {
+                            $this->setNull[$objectKey][$prop] = $prop;
+                        } else {
+                            unset($this->setNull[$objectKey][$prop]);
+                            $object->vars()->$varName = $val;
+                        }
                     }
                 } else {
-                    if ($val !== null) {
+                    if ($val === null) {
+                        $this->setNull[$objectKey][$prop] = $prop;
+                    } else {
+                        unset($this->setNull[$objectKey][$prop]);
                         $object->set($prop, $val);
                     }
                 }
             } else {
-                if ($val !== null) {
+                if ($val === null) {
+                    $this->setNull[$objectKey][$prop] = $prop;
+                } else {
+                    unset($this->setNull[$objectKey][$prop]);
                     $object->set($prop, $val);
                 }
             }
@@ -772,6 +789,12 @@
                 }
             }
         }
+
+        if (isset($this->setNull[$key])) {
+            foreach ($this->setNull[$key] as $property) {
+                $this->objects[$key]->set($property, null);
+            }
+        }
     }
 
     /**
@@ -859,7 +882,10 @@
                 ));
             }
 
-            $this->run->setProperties($runProperties)->store();
+            $this->run->setProperties($runProperties);
+            if (!$this->store->getBranch()->isBranch()) {
+                $this->run->store();
+            }
             $this->notifyResolvers();
             if (! $this->store) {
                 $dba->commit();
@@ -868,7 +894,10 @@
             // Store duration after commit, as the commit might take some time
             $this->run->set('duration_ms', (int) round(
                 (microtime(true) - $this->runStartTime) * 1000
-            ))->store();
+            ));
+            if (!$this->store->getBranch()->isBranch()) {
+                $this->run->store();
+            }
 
             Benchmark::measure('Done applying objects');
         } catch (Exception $e) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.10.0/library/Director/Objects/DirectorJob.php 
new/icingaweb2-module-director-1.10.1/library/Director/Objects/DirectorJob.php
--- 
old/icingaweb2-module-director-1.10.0/library/Director/Objects/DirectorJob.php  
    2022-09-21 11:51:18.000000000 +0200
+++ 
new/icingaweb2-module-director-1.10.1/library/Director/Objects/DirectorJob.php  
    2022-10-07 12:59:52.000000000 +0200
@@ -123,7 +123,7 @@
         }
 
         return (
-            strtotime($this->get('ts_last_attempt')) + 
$this->get('run_interval') * 2
+            strtotime((int) $this->get('ts_last_attempt')) + 
$this->get('run_interval') * 2
         ) < time();
     }
 
@@ -238,7 +238,7 @@
         }
         $name = $properties[$keyCol];
 
-        if ($replace && static::existsWithNameAndId($name, $id, $db)) {
+        if ($replace && $id && static::existsWithNameAndId($name, $id, $db)) {
             $object = static::loadWithAutoIncId($id, $db);
         } elseif ($replace && static::exists($name, $db)) {
             $object = static::load($name, $db);
@@ -251,6 +251,21 @@
             $object = static::create([], $db);
         }
 
+        $settings = (array) $properties['settings'];
+
+        if (array_key_exists('source', $settings) && ! 
(array_key_exists('source_id', $settings))) {
+            $val = ImportSource::load($settings['source'], $db)->get('id');
+            $settings['source_id'] = $val;
+            unset($settings['source']);
+        }
+
+        if (array_key_exists('rule', $settings) && ! 
(array_key_exists('rule_id', $settings))) {
+            $val = SyncRule::load($settings['rule'], $db)->get('id');
+            $settings['rule_id'] = $val;
+            unset($settings['rule']);
+        }
+
+        $properties['settings'] = (object) $settings;
         $object->setProperties($properties);
         if ($id !== null) {
             $object->reallySet($idCol, $id);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.10.0/library/Director/Objects/IcingaObject.php 
new/icingaweb2-module-director-1.10.1/library/Director/Objects/IcingaObject.php
--- 
old/icingaweb2-module-director-1.10.0/library/Director/Objects/IcingaObject.php 
    2022-09-21 11:51:18.000000000 +0200
+++ 
new/icingaweb2-module-director-1.10.1/library/Director/Objects/IcingaObject.php 
    2022-10-07 12:59:52.000000000 +0200
@@ -2736,21 +2736,28 @@
      * @return $this
      * @throws NotFoundError
      */
-    public function replaceWith(IcingaObject $object, $preserve = null)
+    public function replaceWith(IcingaObject $object, $preserve = [])
     {
-        if ($preserve === null) {
-            $this->setProperties((array) $object->toPlainObject());
-        } else {
-            $plain = (array) $object->toPlainObject();
-            foreach ($preserve as $k) {
-                $v = $this->$k;
-                if ($v !== null) {
-                    $plain[$k] = $v;
-                }
-            }
+        return $this->replaceWithProperties($object->toPlainObject(), 
$preserve);
+    }
 
-            $this->setProperties($plain);
+    /**
+     * @param array|object $properties
+     * @param array $preserve
+     * @return $this
+     * @throws NotFoundError
+     */
+    public function replaceWithProperties($properties, $preserve = [])
+    {
+        $properties = (array) $properties;
+        foreach ($preserve as $k) {
+            $v = $this->get($k);
+            if ($v !== null) {
+                $properties[$k] = $v;
+            }
         }
+        $this->setProperties($properties);
+
         return $this;
     }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.10.0/library/Director/Objects/ImportSource.php 
new/icingaweb2-module-director-1.10.1/library/Director/Objects/ImportSource.php
--- 
old/icingaweb2-module-director-1.10.0/library/Director/Objects/ImportSource.php 
    2022-09-21 11:51:18.000000000 +0200
+++ 
new/icingaweb2-module-director-1.10.1/library/Director/Objects/ImportSource.php 
    2022-10-07 12:59:52.000000000 +0200
@@ -92,7 +92,7 @@
         }
         $name = $properties['source_name'];
 
-        if ($replace && static::existsWithNameAndId($name, $id, $db)) {
+        if ($replace && $id && static::existsWithNameAndId($name, $id, $db)) {
             $object = static::loadWithAutoIncId($id, $db);
         } elseif ($replace && static::exists($name, $db)) {
             $object = static::load($name, $db);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.10.0/library/Director/Objects/SyncRule.php 
new/icingaweb2-module-director-1.10.1/library/Director/Objects/SyncRule.php
--- old/icingaweb2-module-director-1.10.0/library/Director/Objects/SyncRule.php 
2022-09-21 11:51:18.000000000 +0200
+++ new/icingaweb2-module-director-1.10.1/library/Director/Objects/SyncRule.php 
2022-10-07 12:59:52.000000000 +0200
@@ -294,7 +294,7 @@
         }
         $name = $properties['rule_name'];
 
-        if ($replace && static::existsWithNameAndId($name, $id, $db)) {
+        if ($replace && $id && static::existsWithNameAndId($name, $id, $db)) {
             $object = static::loadWithAutoIncId($id, $db);
         } elseif ($replace && static::exists($name, $db)) {
             $object = static::load($name, $db);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.10.0/library/Director/Web/Table/IcingaServiceSetServiceTable.php
 
new/icingaweb2-module-director-1.10.1/library/Director/Web/Table/IcingaServiceSetServiceTable.php
--- 
old/icingaweb2-module-director-1.10.0/library/Director/Web/Table/IcingaServiceSetServiceTable.php
   2022-09-21 11:51:18.000000000 +0200
+++ 
new/icingaweb2-module-director-1.10.1/library/Director/Web/Table/IcingaServiceSetServiceTable.php
   2022-10-07 12:59:52.000000000 +0200
@@ -247,4 +247,13 @@
         $deleteLink->handleRequest();
         return $deleteLink;
     }
+
+    public function removeQueryLimit()
+    {
+        $query = $this->getQuery();
+        $query->reset($query::LIMIT_OFFSET);
+        $query->reset($query::LIMIT_COUNT);
+
+        return $this;
+    }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.10.0/library/Director/Web/Table/ObjectsTable.php
 
new/icingaweb2-module-director-1.10.1/library/Director/Web/Table/ObjectsTable.php
--- 
old/icingaweb2-module-director-1.10.0/library/Director/Web/Table/ObjectsTable.php
   2022-09-21 11:51:18.000000000 +0200
+++ 
new/icingaweb2-module-director-1.10.1/library/Director/Web/Table/ObjectsTable.php
   2022-10-07 12:59:52.000000000 +0200
@@ -303,4 +303,13 @@
 
         return $query;
     }
+
+    public function removeQueryLimit()
+    {
+        $query = $this->getQuery();
+        $query->reset($query::LIMIT_OFFSET);
+        $query->reset($query::LIMIT_COUNT);
+
+        return $this;
+    }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/icingaweb2-module-director-1.10.0/module.info 
new/icingaweb2-module-director-1.10.1/module.info
--- old/icingaweb2-module-director-1.10.0/module.info   2022-09-21 
11:51:18.000000000 +0200
+++ new/icingaweb2-module-director-1.10.1/module.info   2022-10-07 
12:59:52.000000000 +0200
@@ -1,5 +1,5 @@
 Name: Icinga Director
-Version: 1.10.0
+Version: 1.10.1
 Depends: reactbundle (>=0.9.0), ipl (>=0.5.0), incubator (>=0.18.0)
 Description: Director - Config tool for Icinga 2
  Icinga Director is a configuration tool that has been designed to make
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.10.0/schema/mysql-migrations/upgrade_182.sql 
new/icingaweb2-module-director-1.10.1/schema/mysql-migrations/upgrade_182.sql
--- 
old/icingaweb2-module-director-1.10.0/schema/mysql-migrations/upgrade_182.sql   
    1970-01-01 01:00:00.000000000 +0100
+++ 
new/icingaweb2-module-director-1.10.1/schema/mysql-migrations/upgrade_182.sql   
    2022-10-07 12:59:52.000000000 +0200
@@ -0,0 +1,12 @@
+DELETE sr.*
+  FROM sync_run sr
+  JOIN sync_rule s ON s.id = sr.rule_id
+  WHERE sr.last_former_activity = sr.last_related_activity
+    AND s.object_type != 'datalistEntry' AND sr.start_time > '2022-09-21 
00:00:00';
+
+DELETE FROM sync_run
+  WHERE (objects_created + objects_deleted + objects_modified) = 0;
+
+INSERT INTO director_schema_migration
+  (schema_version, migration_time)
+  VALUES (182, NOW());
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/icingaweb2-module-director-1.10.0/schema/mysql.sql 
new/icingaweb2-module-director-1.10.1/schema/mysql.sql
--- old/icingaweb2-module-director-1.10.0/schema/mysql.sql      2022-09-21 
11:51:18.000000000 +0200
+++ new/icingaweb2-module-director-1.10.1/schema/mysql.sql      2022-10-07 
12:59:52.000000000 +0200
@@ -2323,7 +2323,6 @@
 
 
   imports TEXT DEFAULT NULL,
-  imports TEXT DEFAULT NULL,
   set_null TEXT DEFAULT NULL,
   PRIMARY KEY (branch_uuid, uuid),
   INDEX search_object_name (object_name),
@@ -2440,4 +2439,4 @@
 
 INSERT INTO director_schema_migration
   (schema_version, migration_time)
-  VALUES (180, NOW());
+  VALUES (182, NOW());
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/icingaweb2-module-director-1.10.0/schema/pgsql-migrations/upgrade_182.sql 
new/icingaweb2-module-director-1.10.1/schema/pgsql-migrations/upgrade_182.sql
--- 
old/icingaweb2-module-director-1.10.0/schema/pgsql-migrations/upgrade_182.sql   
    1970-01-01 01:00:00.000000000 +0100
+++ 
new/icingaweb2-module-director-1.10.1/schema/pgsql-migrations/upgrade_182.sql   
    2022-10-07 12:59:52.000000000 +0200
@@ -0,0 +1,14 @@
+DELETE FROM sync_run AS sr
+  WHERE EXISTS (
+    SELECT 1 FROM sync_rule AS s
+      WHERE s.id = sr.rule_id
+        AND s.object_type != 'datalistEntry'
+        AND sr.start_time > '2022-09-21 00:00:00'
+  ) AND sr.last_former_activity = sr.last_related_activity;
+
+DELETE FROM sync_run
+  WHERE (objects_created + objects_deleted + objects_modified) = 0;
+
+INSERT INTO director_schema_migration
+  (schema_version, migration_time)
+  VALUES (182, NOW());
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/icingaweb2-module-director-1.10.0/schema/pgsql.sql 
new/icingaweb2-module-director-1.10.1/schema/pgsql.sql
--- old/icingaweb2-module-director-1.10.0/schema/pgsql.sql      2022-09-21 
11:51:18.000000000 +0200
+++ new/icingaweb2-module-director-1.10.1/schema/pgsql.sql      2022-10-07 
12:59:52.000000000 +0200
@@ -2778,4 +2778,4 @@
 
 INSERT INTO director_schema_migration
   (schema_version, migration_time)
-  VALUES (181, NOW());
+  VALUES (182, NOW());

Reply via email to