Skip to content

Allow for more then just $config$ in Service Apply For Rule properties #2432

@v0tti

Description

@v0tti

Expected Behavior

I have a data field looking like something like this:

 {
    "name" => "Name".
    "parameter1" => 123,
    "parameter2" => 456
 }

I use it in an Service Apply Rule with Apply For.

I set the following:
Service Name: Check $config.name$
Custom Properties: Property 1 => $config.parameter1$ and Property 2 => $config.parameter2$

I expect the Service to be named Check Name and the properties to be set to 123 and 456 respectively.

Current Behavior

The Service gets named correctly.
The two properties will be populated with the String "$config.parameter1$" and "$config.parameter2$".

The check will report as UNKNOWN with this error:
Error: Non-optional macro 'config.parameter1' used in argument 'parameter1' is missing.

It seems the macro is expanded at a later point, which is not possible anymore since context is missing.

Possible Solution

Allow for specifying parameters in Custom Properties. At the moment only $config$ is allowed in https://github.com/Icinga/icingaweb2-module-director/blob/master/library/Director/CustomVariable/CustomVariableString.php#L49 but this will fill in my entire object.

Your Environment

  • Director version (System - About): 1.8.0
  • Icinga Web 2 version and modules (System - About): 2.9.5
  • Operating System and version: Rocky Linux 8
  • Webserver, PHP versions: PHP 8.0.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions