From aeef51ffa65dfd95b5b3d643c257006d7a4d6e25 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 9 Feb 2022 21:59:53 +0100 Subject: [PATCH] IcingaArguments: allow to restore set_if_format fixes #2291 --- library/Director/Objects/IcingaArguments.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/library/Director/Objects/IcingaArguments.php b/library/Director/Objects/IcingaArguments.php index 1492ecd8..e2115299 100644 --- a/library/Director/Objects/IcingaArguments.php +++ b/library/Director/Objects/IcingaArguments.php @@ -190,10 +190,14 @@ class IcingaArguments implements Iterator, Countable, IcingaConfigRenderer } } - if (array_key_exists('set_if', $attrs) && is_object($attrs['set_if'])) { - if ($attrs['set_if']->type === 'Function') { + if (array_key_exists('set_if', $attrs)) { + if (is_object($attrs['set_if']) && $attrs['set_if']->type === 'Function') { $attrs['set_if'] = '/* Unable to fetch function body through API */'; $attrs['set_if_format'] = 'expression'; + } elseif (property_exists($value, 'set_if_format')) { + if (in_array($value->set_if_format, ['string', 'expression', 'json'])) { + $attrs['set_if_format'] = $value->set_if_format; + } } }