IcingaObject: do not clear imports on merge...

...when merged object has no imports
This commit is contained in:
Thomas Gelf 2017-09-06 01:31:14 +02:00
parent c0a08584ef
commit 6d562eef12
1 changed files with 11 additions and 0 deletions

View File

@ -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;
}