Search chef: knife vs recipe


#1

I’m having a hard time finding actual answers to my questions about this,
so now it’s list time. I’m trying to use the Chef server search API to
generate parts of my Sensu configuration and am running into problems
trying to deep match attributes. It seems that the flattened attributes
aren’t accessible with a recipe… or I’m crazy.

  • This works: knife search node ‘alti_sensu_client:check_http’
  • This recipe snippet does not: search(:node,
    ‘alti_sensu_client:check_http’)
  • This recipe snippet does: search(:node, ‘check_http:*’)

While the last item works, it’s not a very strict match and I’d really like
it to be. Should the second item work or not?

–tucker


#2

On Friday, October 10, 2014 at 11:29 AM, Tucker wrote:

I’m having a hard time finding actual answers to my questions about this, so now it’s list time. I’m trying to use the Chef server search API to generate parts of my Sensu configuration and am running into problems trying to deep match attributes. It seems that the flattened attributes aren’t accessible with a recipe… or I’m crazy.

  • This works: knife search node ‘alti_sensu_client:check_http’
  • This recipe snippet does not: search(:node, ‘alti_sensu_client:check_http’)
  • This recipe snippet does: search(:node, ‘check_http:*’)

While the last item works, it’s not a very strict match and I’d really like it to be. Should the second item work or not?

–tucker

From a quick look, these should be identical. Do you own the server you’re connecting to? If so, can you check the logs to compare the query parts of the URLs that chef-client and knife are requesting? If it’s on hosted enterprise chef, contact support to get this info for you.


Daniel DeLeo