icingaweb2-module-director icon indicating copy to clipboard operation
icingaweb2-module-director copied to clipboard

Add wildcard support for contains and render with match()

Open lazyfrosch opened this issue 5 years ago • 15 comments

This used MatchAny explicitly, since we check against an array here.

When a user specifies an filter like this in Director:

host.groups contains "customer*"

The Director should render it as:

assign where match("customer*", host.groups, MatchAny)

For backwards compatibility I wouldn't change wildcards with =, but for contains this new behavior here should be expected.

ref/NC/620757

lazyfrosch avatar Mar 05 '20 10:03 lazyfrosch

@lazyfrosch: thanks, this would make a nice feature. Did you test whether our (Web) Filters are able to calculate the same result? There must be a discrepancy either before or after this modification I guess

Thomas-Gelf avatar Mar 05 '20 11:03 Thomas-Gelf

@Thomas-Gelf How would this be related to the web filters? The AssignRenderer is already quite specific to Director. I've only added the recognition of wildcards with the contains logic

Please see the updated unit test.

lazyfrosch avatar Mar 06 '20 15:03 lazyfrosch

@lazyfrosch: relation to web filters -> we cannot deploy Filters we're unable to evaluate by ourselves

Thomas-Gelf avatar Mar 06 '20 16:03 Thomas-Gelf

I still don't get the point, sorry.

lazyfrosch avatar Mar 06 '20 16:03 lazyfrosch

ObjectApplyMatches must provide the same result as Icinga 2. Either it currently behaves differently than the core, or it will do so after this patch

Thomas-Gelf avatar Mar 06 '20 21:03 Thomas-Gelf

Any update on this? @lazyfrosch @Thomas-Gelf We just stumbled upon this, as we have hosts with an array variable filled with tags. Now having an apply rule like host.vars.tags contains "tag_thistag" works without problems, but host.vars.tags contains "tag_handle_*" does not. This forces us to use the Icinga DSL and config files for certain things.

Is this to be expected to work any time soon?

log1-c avatar Feb 19 '21 12:02 log1-c

Can we expect this in release 1.9? Because of the missing possibility to add a "MatchAny" we have to maintain .conf files in addition to the director configuration.

khmuth avatar Jun 01 '21 09:06 khmuth

Hi @Thomas-Gelf @lazyfrosch is there any chance this will be pulled and put in a release ? We have a big customer which we need to patch at every update.

sciolto avatar May 11 '23 08:05 sciolto

I haven't been involved with Icinga for a while now, hopefully this will get merged some day...

lazyfrosch avatar May 11 '23 09:05 lazyfrosch

@Thomas-Gelf have you had the chance to review this PR ? thanks Oreste

sciolto avatar Aug 21 '23 06:08 sciolto

ref/IP/52313

nilmerg avatar Feb 28 '24 12:02 nilmerg