Search code examples
chef-infraknife

knife search returns stale data until chef-client runs. Is this avoidable?


Example: devjmxpx03/4 are preexisting nodes with the jmx-proxy-service-tmbveg1 role applied to them. After applying the role to a new node (devjmxpx05), the new node is not immediately available in searches.

[~/chef/roles/jmx-proxy-service]$ knife search roles:jmx-proxy-service-tmbveg1 -i
2 items found

devjmxpx03
devjmxpx04

Once chef-client runs on devjmxpx05, it shows up in searches as expected.

Is there any way around this behavior so that the node will show up in role searches as soon as the role is applied? Perhaps some additional search parameters?

We are running Chef server v 11.0.8.


Solution

  • There is difference between role and roles when doing searches. It's described in search documentation. Just keep in mind using roles will look in expanded run_list, role won't (it's described in doc as well).

    So you probably want to use role if it's in top level run list. I think it worked the same in 11.x.