Solved: Search Index and roles


#1

Hi again,

I think that now I have it working with run_list:

search(:node, “run_list:role”) do |server|
backend_servers << { “hostname” => server[‘hostname’], “ip” =>
server[‘ipaddress’] }
end

Is the correct procedure?

Sorry and thanks!

Jose Luis

2009/8/13 Jose Luis Gordo Romero jgordor@gmail.com

Hi!

I’m writing a cookbook that uses search to find nodes with a certain role
in their run_list:

search(:node, “role:somorole”) do |server|
backend_servers << { “hostname” => server[‘hostname’], “ip” =>
server[‘ipaddress’] }
end

But nothing is returned, then I test:

search(:node, “recipe:ubuntu”) do |server|
backend_servers << { “hostname” => server[‘hostname’], “ip” =>
server[‘ipaddress’] }
end

But nothing is returned too, I’m sure that I have nodes with the role or
recipes (from roles).

search(:node, “*”) do |server|
backend_servers << { “hostname” => server[‘hostname’], “ip” =>
server[‘ipaddress’] }
end

Is working with all nodes, so:

Is that roles or recipes through roles in search in not supported?

Thanks in advance
Jose Luis


#2

Searching for “role:my_role” also doesn’t work for me when used in the
search() function or the web interface. I’ve been using search(:node, "my_role") in my recipes and that seems to provide the correct results in
the few places I’ve tried it. When I asked in IRC I was told that 0.8 should
be improving the search functionality a bit.

On Thu, Aug 13, 2009 at 2:28 AM, Jose Luis Gordo Romero
jgordor@gmail.comwrote:

Hi again,

I think that now I have it working with run_list:

search(:node, “run_list:role”) do |server|
backend_servers << { “hostname” => server[‘hostname’], “ip” =>
server[‘ipaddress’] }
end

Is the correct procedure?

Sorry and thanks!

Jose Luis

2009/8/13 Jose Luis Gordo Romero jgordor@gmail.com

Hi!

I’m writing a cookbook that uses search to find nodes with a certain role
in their run_list:

search(:node, “role:somorole”) do |server|
backend_servers << { “hostname” => server[‘hostname’], “ip” =>
server[‘ipaddress’] }
end

But nothing is returned, then I test:

search(:node, “recipe:ubuntu”) do |server|
backend_servers << { “hostname” => server[‘hostname’], “ip” =>
server[‘ipaddress’] }
end

But nothing is returned too, I’m sure that I have nodes with the role or
recipes (from roles).

search(:node, “*”) do |server|
backend_servers << { “hostname” => server[‘hostname’], “ip” =>
server[‘ipaddress’] }
end

Is working with all nodes, so:

Is that roles or recipes through roles in search in not supported?

Thanks in advance
Jose Luis


#3

Thanks Garret, I will try this instead run_list (make things more clear).

Jose Luis

2009/8/13 Garret Heaton powdahound@gmail.com

Searching for “role:my_role” also doesn’t work for me when used in the
search() function or the web interface. I’ve been using search(:node, "my_role") in my recipes and that seems to provide the correct results in
the few places I’ve tried it. When I asked in IRC I was told that 0.8 should
be improving the search functionality a bit.

On Thu, Aug 13, 2009 at 2:28 AM, Jose Luis Gordo Romero <jgordor@gmail.com

wrote:

Hi again,

I think that now I have it working with run_list:

search(:node, “run_list:role”) do |server|
backend_servers << { “hostname” => server[‘hostname’], “ip” =>
server[‘ipaddress’] }
end

Is the correct procedure?

Sorry and thanks!

Jose Luis

2009/8/13 Jose Luis Gordo Romero jgordor@gmail.com

Hi!

I’m writing a cookbook that uses search to find nodes with a certain role
in their run_list:

search(:node, “role:somorole”) do |server|
backend_servers << { “hostname” => server[‘hostname’], “ip” =>
server[‘ipaddress’] }
end

But nothing is returned, then I test:

search(:node, “recipe:ubuntu”) do |server|
backend_servers << { “hostname” => server[‘hostname’], “ip” =>
server[‘ipaddress’] }
end

But nothing is returned too, I’m sure that I have nodes with the role or
recipes (from roles).

search(:node, “*”) do |server|
backend_servers << { “hostname” => server[‘hostname’], “ip” =>
server[‘ipaddress’] }
end

Is working with all nodes, so:

Is that roles or recipes through roles in search in not supported?

Thanks in advance
Jose Luis