ObjectCommand: use real/file-based renderer

fixes #2550
fixes #2204
This commit is contained in:
Thomas Gelf 2022-04-26 13:30:54 +02:00
parent 0f6fc7bfd0
commit 31c06d8156

View File

@ -4,6 +4,7 @@ namespace Icinga\Module\Director\Cli;
use Icinga\Cli\Params;
use Icinga\Exception\MissingParameterException;
use Icinga\Module\Director\IcingaConfig\IcingaConfig;
use Icinga\Module\Director\Objects\IcingaObject;
use InvalidArgumentException;
@ -55,7 +56,12 @@ class ObjectCommand extends Command
$data = $object->toPlainObject(false, $noDefaults);
echo $this->renderJson($data, !$this->params->shift('no-pretty'));
} else {
echo $object;
$config = new IcingaConfig($db);
$object->renderToConfig($config);
foreach ($config->getFiles() as $filename => $content) {
printf("/** %s **/\n\n", $filename);
echo $content;
}
}
}