[chef] Re: Re: Search in Chef 11


Chronological Thread 
  • From: " " < >
  • To: chef < >
  • Subject: [chef] Re: Re: Search in Chef 11
  • Date: Tue, 29 Jul 2014 09:09:15 -0500

Thanks for the reply Steven. The search started giving a 400 Bad Request in Chef 11. Specifically all I was getting on the client end was this:

Net::HTTPServerException
------------------------
400 "Bad Request"

Digging deeper, I was able to figure out the root cause of my problem. The issue is that my query had newline characters in it. So for instance, the query

search(:node, "my_attribute:test AND (roles:first_role 
                                                        OR roles:second_role 
                                                        OR roles:third_role 
                                                        OR roles:fourth_role)")

This will work just fine with Chef 10 but will fail with Chef 11 with the 400 error. Removing the newlines, I was able to get it working for both versions.

Do you think this is a bug or an expected behavior? I wasn't able to find any documentation surrounding this here[1].



On Tue, Jul 29, 2014 at 6:51 AM, Steven Danna < " target="_blank"> > wrote:
Hi,

> The problem is this used to work fine with Chef 10 but has started failing with Chef 11.

When you say that the search started to fail, do you mean that you are
receiving an error message or that the search no longer returns the
expected results?

Sincerely,

Steven

On Tue, Jul 29, 2014 at 7:13 AM, ">
< "> > wrote:
> Hello,
>
> We are trying to run a little complex search query in one of our recipes
> which looks something like:
>
> search(:node, "my_attribute:test AND (roles:first_role OR roles:second_role
> OR roles:third_role OR roles:fourth_role)")
>
> The idea being to retrieve all nodes which have a particular attribute set
> and has one of the given roles on its runlist. Is the above query the best
> way to write that? The problem is this used to work fine with Chef 10 but
> has started failing with Chef 11.
>
> Any help will be greatly appreciated.
>
> Thanks,
>
> --
> Swarnim



--
Swarnim



Archive powered by MHonArc 2.6.16.

§