Partial search

is partial search implemented yet? I see documentation for it, but i don’t
see any reference to a partial_search method in any of the chef client
codebase.

the current chef-server-webui has a bug in the status page that it only
displays 20 results and has no paging… i’d like to get it at least
showing all results as it did in previous releases, but while i was at it i
wanted to try to speed up the display a bit… setting it to only return
the fields necessary seems like a good place to start, but i haven’t found
it implemented anywhere.

thanks!

http://community.opscode.com/cookbooks/partial_search

I play to integrate this functionality in to the Heavy Water Discovery cookbook.

Cheers,

AJ

On 14 February 2013 09:12, Jesse Campbell hikeit@gmail.com wrote:

is partial search implemented yet? I see documentation for it, but i don't
see any reference to a partial_search method in any of the chef client
codebase.

the current chef-server-webui has a bug in the status page that it only
displays 20 results and has no paging... i'd like to get it at least showing
all results as it did in previous releases, but while i was at it i wanted
to try to speed up the display a bit... setting it to only return the fields
necessary seems like a good place to start, but i haven't found it
implemented anywhere.

thanks!

Thanks, I found that after posting and since I can't exactly use cookbook
code in chef-server-webui, I've been attempting to figure out how to use
that code, and i think i might have just gotten it.

Only trouble is that if I ask for "run_list", I get back an array of the
names of the run list items, instead of an array of run list items (where
each should be a hash containing name, version, and type).

would be nice to see the chef server code...

On Wed, Feb 13, 2013 at 3:33 PM, AJ Christensen aj@junglist.gen.nz wrote:

http://community.opscode.com/cookbooks/partial_search

I play to integrate this functionality in to the Heavy Water Discovery
cookbook.

Cheers,

AJ

On 14 February 2013 09:12, Jesse Campbell hikeit@gmail.com wrote:

is partial search implemented yet? I see documentation for it, but i
don't
see any reference to a partial_search method in any of the chef client
codebase.

the current chef-server-webui has a bug in the status page that it only
displays 20 results and has no paging... i'd like to get it at least
showing
all results as it did in previous releases, but while i was at it i
wanted
to try to speed up the display a bit... setting it to only return the
fields
necessary seems like a good place to start, but i haven't found it
implemented anywhere.

thanks!

It's working in 11.

Adam

From: Jesse Campbell <hikeit@gmail.commailto:hikeit@gmail.com>
Reply-To: "chef@lists.opscode.commailto:chef@lists.opscode.com" <chef@lists.opscode.commailto:chef@lists.opscode.com>
Date: Wednesday, February 13, 2013 1:43 PM
To: chef <chef@lists.opscode.commailto:chef@lists.opscode.com>
Subject: [chef] Re: Re: partial search

Thanks, I found that after posting and since I can't exactly use cookbook code in chef-server-webui, I've been attempting to figure out how to use that code, and i think i might have just gotten it.

Only trouble is that if I ask for "run_list", I get back an array of the names of the run list items, instead of an array of run list items (where each should be a hash containing name, version, and type).

would be nice to see the chef server code...

On Wed, Feb 13, 2013 at 3:33 PM, AJ Christensen <aj@junglist.gen.nzmailto:aj@junglist.gen.nz> wrote:
http://community.opscode.com/cookbooks/partial_search

I play to integrate this functionality in to the Heavy Water Discovery cookbook.

Cheers,

AJ

On 14 February 2013 09:12, Jesse Campbell <hikeit@gmail.commailto:hikeit@gmail.com> wrote:

is partial search implemented yet? I see documentation for it, but i don't
see any reference to a partial_search method in any of the chef client
codebase.

the current chef-server-webui has a bug in the status page that it only
displays 20 results and has no paging... i'd like to get it at least showing
all results as it did in previous releases, but while i was at it i wanted
to try to speed up the display a bit... setting it to only return the fields
necessary seems like a good place to start, but i haven't found it
implemented anywhere.

thanks!

should I be able to use partial search to fetch hash values from the node
tree, or can i only get individual string values?
i'd like to grab the run list, which is an array of hashes, and i'm getting
an array of strings. this is not the same thing.

within cookbooks, should I be able to use partial_search directly, or do I
need to include the partial_search cookbook?

On Wed, Feb 13, 2013 at 4:51 PM, Adam Jacob adam@opscode.com wrote:

It's working in 11.

Adam

From: Jesse Campbell hikeit@gmail.com
Reply-To: "chef@lists.opscode.com" chef@lists.opscode.com
Date: Wednesday, February 13, 2013 1:43 PM
To: chef chef@lists.opscode.com
Subject: [chef] Re: Re: partial search

Thanks, I found that after posting and since I can't exactly use
cookbook code in chef-server-webui, I've been attempting to figure out how
to use that code, and i think i might have just gotten it.

Only trouble is that if I ask for "run_list", I get back an array of the
names of the run list items, instead of an array of run list items (where
each should be a hash containing name, version, and type).

would be nice to see the chef server code...

On Wed, Feb 13, 2013 at 3:33 PM, AJ Christensen aj@junglist.gen.nzwrote:

http://community.opscode.com/cookbooks/partial_search

I play to integrate this functionality in to the Heavy Water Discovery
cookbook.

Cheers,

AJ

On 14 February 2013 09:12, Jesse Campbell hikeit@gmail.com wrote:

is partial search implemented yet? I see documentation for it, but i
don't
see any reference to a partial_search method in any of the chef client
codebase.

the current chef-server-webui has a bug in the status page that it only
displays 20 results and has no paging... i'd like to get it at least
showing
all results as it did in previous releases, but while i was at it i
wanted
to try to speed up the display a bit... setting it to only return the
fields
necessary seems like a good place to start, but i haven't found it
implemented anywhere.

thanks!

The run list is not an array of hashes, it is stored as an array like ['role[foo]', ...]

--Noah

Jesse Campbell hikeit@gmail.com wrote:

should I be able to use partial search to fetch hash values from the
node
tree, or can i only get individual string values?
i'd like to grab the run list, which is an array of hashes, and i'm
getting
an array of strings. this is not the same thing.

within cookbooks, should I be able to use partial_search directly, or
do I
need to include the partial_search cookbook?

On Wed, Feb 13, 2013 at 4:51 PM, Adam Jacob adam@opscode.com wrote:

It's working in 11.

Adam

From: Jesse Campbell hikeit@gmail.com
Reply-To: "chef@lists.opscode.com" chef@lists.opscode.com
Date: Wednesday, February 13, 2013 1:43 PM
To: chef chef@lists.opscode.com
Subject: [chef] Re: Re: partial search

Thanks, I found that after posting and since I can't exactly use
cookbook code in chef-server-webui, I've been attempting to figure
out how
to use that code, and i think i might have just gotten it.

Only trouble is that if I ask for "run_list", I get back an array of
the
names of the run list items, instead of an array of run list items
(where
each should be a hash containing name, version, and type).

would be nice to see the chef server code...

On Wed, Feb 13, 2013 at 3:33 PM, AJ Christensen
aj@junglist.gen.nzwrote:

http://community.opscode.com/cookbooks/partial_search

I play to integrate this functionality in to the Heavy Water
Discovery
cookbook.

Cheers,

AJ

On 14 February 2013 09:12, Jesse Campbell hikeit@gmail.com wrote:

is partial search implemented yet? I see documentation for it, but
i
don't
see any reference to a partial_search method in any of the chef
client
codebase.

the current chef-server-webui has a bug in the status page that it
only
displays 20 results and has no paging... i'd like to get it at
least
showing
all results as it did in previous releases, but while i was at it
i
wanted
to try to speed up the display a bit... setting it to only return
the
fields
necessary seems like a good place to start, but i haven't found it
implemented anywhere.

thanks!

Here's an example of converting a cookbook to use partial_search:

https://github.com/lamont-granquist/ssh_known_hosts/commit/7468869db49c87ef575edd702bfed8e0bfb9d9be

On 2/13/13 2:09 PM, Jesse Campbell wrote:

should I be able to use partial search to fetch hash values from the
node tree, or can i only get individual string values?
i'd like to grab the run list, which is an array of hashes, and i'm
getting an array of strings. this is not the same thing.

within cookbooks, should I be able to use partial_search directly, or
do I need to include the partial_search cookbook?

On Wed, Feb 13, 2013 at 4:51 PM, Adam Jacob <adam@opscode.com
mailto:adam@opscode.com> wrote:

It's working in 11.

Adam

From: Jesse Campbell <hikeit@gmail.com <mailto:hikeit@gmail.com>>
Reply-To: "chef@lists.opscode.com <mailto:chef@lists.opscode.com>"
<chef@lists.opscode.com <mailto:chef@lists.opscode.com>>
Date: Wednesday, February 13, 2013 1:43 PM
To: chef <chef@lists.opscode.com <mailto:chef@lists.opscode.com>>
Subject: [chef] Re: Re: partial search

Thanks, I found that after posting and since I can't exactly use
cookbook code in chef-server-webui, I've been attempting to figure
out how to use that code, and i think i might have just gotten it.

Only trouble is that if I ask for "run_list", I get back an array
of the names of the run list items, instead of an array of run
list items (where each should be a hash containing name, version,
and type).

would be nice to see the chef server code...


On Wed, Feb 13, 2013 at 3:33 PM, AJ Christensen
<aj@junglist.gen.nz <mailto:aj@junglist.gen.nz>> wrote:

    http://community.opscode.com/cookbooks/partial_search

    I play to integrate this functionality in to the Heavy Water
    Discovery cookbook.

    Cheers,

    AJ

    On 14 February 2013 09:12, Jesse Campbell <hikeit@gmail.com
    <mailto:hikeit@gmail.com>> wrote:
    > is partial search implemented yet? I see documentation for
    it, but i don't
    > see any reference to a partial_search method in any of the
    chef client
    > codebase.
    >
    > the current chef-server-webui has a bug in the status page
    that it only
    > displays 20 results and has no paging... i'd like to get it
    at least showing
    > all results as it did in previous releases, but while i was
    at it i wanted
    > to try to speed up the display a bit... setting it to only
    return the fields
    > necessary seems like a good place to start, but i haven't
    found it
    > implemented anywhere.
    >
    > thanks!

you have to include the partial search cookbook , (depends in metadata
will ensure its downloaded, while include will ensure its libraries/lwrps
are loaded),iirc

On Wed, Feb 13, 2013 at 2:09 PM, Jesse Campbell hikeit@gmail.com wrote:

should I be able to use partial search to fetch hash values from the node
tree, or can i only get individual string values?
i'd like to grab the run list, which is an array of hashes, and i'm
getting an array of strings. this is not the same thing.

within cookbooks, should I be able to use partial_search directly, or do I
need to include the partial_search cookbook?

On Wed, Feb 13, 2013 at 4:51 PM, Adam Jacob adam@opscode.com wrote:

It's working in 11.

Adam

From: Jesse Campbell hikeit@gmail.com
Reply-To: "chef@lists.opscode.com" chef@lists.opscode.com
Date: Wednesday, February 13, 2013 1:43 PM
To: chef chef@lists.opscode.com
Subject: [chef] Re: Re: partial search

Thanks, I found that after posting and since I can't exactly use
cookbook code in chef-server-webui, I've been attempting to figure out how
to use that code, and i think i might have just gotten it.

Only trouble is that if I ask for "run_list", I get back an array of
the names of the run list items, instead of an array of run list items
(where each should be a hash containing name, version, and type).

would be nice to see the chef server code...

On Wed, Feb 13, 2013 at 3:33 PM, AJ Christensen aj@junglist.gen.nzwrote:

http://community.opscode.com/cookbooks/partial_search

I play to integrate this functionality in to the Heavy Water Discovery
cookbook.

Cheers,

AJ

On 14 February 2013 09:12, Jesse Campbell hikeit@gmail.com wrote:

is partial search implemented yet? I see documentation for it, but i
don't
see any reference to a partial_search method in any of the chef client
codebase.

the current chef-server-webui has a bug in the status page that it only
displays 20 results and has no paging... i'd like to get it at least
showing
all results as it did in previous releases, but while i was at it i
wanted
to try to speed up the display a bit... setting it to only return the
fields
necessary seems like a good place to start, but i haven't found it
implemented anywhere.

thanks!

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 noah@coderanger.netwrote:

The run list is not an array of hashes, it is stored as an array like
['role[foo]', ...]

--Noah

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 <noah@coderanger.net
mailto:noah@coderanger.net> wrote:

The run list is not an array of hashes, it is stored as an array
like ['role[foo]', ...]

--Noah

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 noah@coderanger.netwrote:

The run list is not an array of hashes, it is stored as an array like
['role[foo]', ...]

--Noah

You can always just manually instantiate RunList, the same way Node#initialize works :slight_smile: the automated casting to an actual node object is a feature of the ruby json library, not chef itself.

Jesse Campbell hikeit@gmail.com 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
noah@coderanger.netwrote:

The run list is not an array of hashes, it is stored as an array
like
['role[foo]', ...]

--Noah

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 noah@coderanger.netwrote:

You can always just manually instantiate RunList, the same way
Node#initialize works :slight_smile: the automated casting to an actual node object is
a feature of the ruby json library, not chef itself.

Jesse Campbell hikeit@gmail.com 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 noah@coderanger.netwrote:

The run list is not an array of hashes, it is stored as an array like
['role[foo]', ...]

--Noah

On Wednesday, February 13, 2013 at 5:10 PM, Jesse Campbell wrote:

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.

Converting a run list item to a string and back loses no information. See for yourself:

--
Daniel DeLeo

Excellent!
I've updated my pull request to chef-server-webui to fix the 20 node limit
on the status page, using partial search and still showing all of the info.
Thanks!

On Thu, Feb 14, 2013 at 12:58 PM, Daniel DeLeo dan@kallistec.com wrote:

On Wednesday, February 13, 2013 at 5:10 PM, Jesse Campbell wrote:

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.

Converting a run list item to a string and back loses no information. See
for yourself:

chef/lib/chef/run_list/run_list_item.rb at main · chef/chef · GitHub

--
Daniel DeLeo