I’ve been battling this for a bit, but I’m trying to figure out how to use a “const” in a command argument. For some reason, whenever I use the $const_name$ as the value of the argument, it silently gets removed.
for example:
I have a const.conf file that defines the following:
Unfortunately, (guess I should have mentioned it) Director forces the quotes around the “value” field. I did try manually creating the template, but now the icinga daemon won’t start with the error
critical/config: Error: Validation failed for object 'check_test' of type 'CheckCommand'; Attribute 'arguments' -> '--const': Invalid type.
I think I’m making some progress… the “const_name” is an array, which I was hoping would be passed as a string. I tried to use json.encode() on it, but it is complaining with “Error: Argument is not a callable object.” whenever the check command is executed.
specifically, I tried using {{ return json.encode(const_name) }}
Does anyone know of a good way to json encode a variable into a single line that is useable?
I managed to sort-of make this work by setting the const to a single-line json encoded string. Is there no way to json encode a variable to use it as an argument?