[chef] Re: Re: Re: partial search


Chronological Thread 
  • From: Jesse Campbell < >
  • To: chef < >
  • Subject: [chef] Re: Re: Re: partial search
  • Date: Wed, 13 Feb 2013 20:10:44 -0500

I was thinking to do that, but the "version" string probably wouldn't be correct, since it should be set by the node.save, and if i instantiated it where i was doing the search, it wouldn't necessarily be the same (it may not adhere to the cookbook version overrides in the environment of the target node).

ah well... i've never looked at the "version" or "type" columns on the web ui anyways, i'll just make it a list.

now if only i could figure out how to tell it to pop up the tooltip to the left of the mouse instead of the right.


On Wed, Feb 13, 2013 at 7:24 PM, Noah Kantrowitz < " target="_blank"> > wrote:
You can always just manually instantiate RunList, the same way Node#initialize works :) the automated casting to an actual node object is a feature of the ruby json library, not chef itself.


Jesse Campbell < " target="_blank"> > wrote:

I disagree. Search returns a json serialized node object, which can be turned back into a node. Partial search returns json strings and arrays of strings.

Not to be difficult, but I've just done it, and that is the result. From a search, you can do result.run_list[0].name whereas from a partial search you must to result['data']['run_list'][0] and the .name, .type, and .version are collapsed to just a single string.

-Jesse


the thing you get back from search is the json-serialized representation of the node, not the chef node ruby object.

search or partial_search always gives similar results to knife search:

knife search node '*:*' -a run_list -Fj

On 2/13/13 2:35 PM, Jesse Campbell wrote:
Valid point
but node.run_list is a Chef::RunList, which can be treated like a hash that contains name, version, type.
there is no way i can see in partial search to get this object.




On Wed, Feb 13, 2013 at 5:23 PM, Noah Kantrowitz < " target="_blank"> > wrote:
The run list is not an array of hashes, it is stored as an array like ['role[foo]', ...]

--Noah





Archive powered by MHonArc 2.6.16.

§