From 6d562eef12a8f5338394066cbc2ab326966dc9ed Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 6 Sep 2017 01:31:14 +0200 Subject: [PATCH] IcingaObject: do not clear imports on merge... ...when merged object has no imports --- library/Director/Objects/IcingaObject.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/library/Director/Objects/IcingaObject.php b/library/Director/Objects/IcingaObject.php index 0d658c24..ec2a07ec 100644 --- a/library/Director/Objects/IcingaObject.php +++ b/library/Director/Objects/IcingaObject.php @@ -2411,6 +2411,11 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer $object->set('groups', []); } + if ($object->supportsImports()) { + $imports = $object->listImportNames(); + $object->set('imports', []); + } + $plain = (array) $object->toPlainObject(false, false); unset($plain['vars']); unset($plain['groups']); @@ -2441,6 +2446,12 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer } } + if ($object->supportsImports()) { + if (! empty($imports)) { + $this->set('imports', $imports); + } + } + return $this; }