API Search Host Parameter Value

I’m seeing some references to being able to search for a host by using params.<key>=<value> however I am not getting any results. At the end of the day we have a couple static host parameters (strings) that we want to be able to search (asset & install location information). This information is being set via API calls at host creation time. Attempting to search is also being done via the api.

We can create facts at the same time but rebuilds become a question. We have just started working with hooks and can probably do something there to re-create the facts when a rebuild occurs.

To be clear we are NOT trying to search for the value of a puppet class parameter that will be used on a host.

Thoughts on how to search?

1 Like

I can see this as well, reported https://bugzilla.redhat.com/show_bug.cgi?id=1714357

I think this has changed while parameters got support for various types, I think @kgaikwad will be able to tell, if this is now supposed to work. I know we considered searching in serialized value, but not sure, what was the outcome.

As @Marek_Hulan mentioned, searching by parameter value has changed. Instead of value, searching by parameter name column is available. i.e “params = test_param”

Serialize has the disadvantage that you can’t search by SQL on it. We have discussed about how we can achieve searching in serialized value. One solution would be to store value in other column to do full text search but it is not yet implemented.

This has been fixed by

It should get in for 1.24, it will be appreciated if someone can test that in nightlies.

Oh jeez. Glad we haven’t upgraded yet(though to thier credit I do remember a note of this in the release or upgrade notes) This would have broken pretty much everything in our automation and orchestration tier. Any chance of this fix being backported to a dot release in the version that “broke” it. Foreman being unable to do major version “jimps” as upgrades means one would have to upgrade “through” major versions where this didn’t work.

As mentioned in the bugzilla, definitely seems like a regression, so I’d vote for fixing it in the next dot release of any major where it’s broken??

I found this thread as we experience the same “Field … not recognized for searching!” when searching for Hostgroups. This breaks integrations with Foreman for us.

Has this issue been fixed when searching for Hostgroups as well?

Thank you @sigbjornaib for reporting this. It won’t fix searching issue on hostgroup page as it was specific to searching on host page.
To track, sharing an issue that is opened few days back - Bug #29683: Unable to search by value of certain Hostgroup parameter - Foreman

1 Like

Thank you, Bug #29683 is the result of a Support Case I opened with RH Support.:slight_smile:

okies :slight_smile:
Pull-request opened for this change - Fixes #29683 - fix params search on hg,os,domain,subnet pages by kgaikwad · Pull Request #7670 · theforeman/foreman · GitHub
This will resolve params search on other resources i.e hostgroup, subnet, domain, os