Foreman Doc’s, as well as autocomplete list (^) as a valid operation. it translates to IN in SQL-speak. However - no valid examples are provided anywhere that i can find.
I attempted today for a while to make it work. I have a query right now as follows:
params.param1 = stuff or params.param1 = things or params.param1 = stuff2 … params.param1 = finalthing
I’m trying to switch this to IN but i can’t figure out the syntax in the UI (to then translate to the API eventually)
Does anyone have a working example using ^ with multiple items? I’ve tried ", ', , () and many combinations of them - all resulting in mysql syntax error(s) as it isnt getting passed to mysql in the correct format…
The only thing i’ve gotten to work is a single check params.param1 ^ stuff
but that is no better than equals…
TY in advance!
~Jason Lang
Hi,
this works for me name ^ (default, test)
Hope that helps
Hello Jason,
The correct format should be params.param1 ^ (stuff, things, stuff2)
and works for e.g. name : name ^ (host1.my.lan, host2.my.lan)
. For params it does not work properly and is producing invalid SQL. This is IMO a bug and should be reported. Could you file it as a new issue in our tracker (https://projects.theforeman.org/projects/foreman/issues/new) or should I do it?
Regards,
Martin
@mbacovsky @Marek_Hulan Thanks for the help!
It turns out the syntax i had was indeed correct (and simple!) I had been taring my hair out thinking i was missing undocumented escape characters in my query, however, as soon as i tried with “environment” or “name” it worked flawlessly. It seems it is indeed like you said and the bug lies when doing a list search using “params”
I’ve opened a issue item with the mysql error it is throwing here: Bug #25663: Foreman Search “list” syntax with Params does not work - Foreman
Thanks again for the sanity check!
1 Like