Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

The search-utils cookbook has been deprecated

Author provided reason for deprecation:

The search-utils cookbook has been deprecated and is no longer being maintained by its authors. Use of the search-utils cookbook is no longer recommended.

You may find that the alternate_search cookbook is a suitable alternative.

RSS

search-utils (3) Versions 1.1.0

Wrapper around the partial_search cookbook

Policyfile
Berkshelf
Knife
cookbook 'search-utils', '= 1.1.0', :supermarket
cookbook 'search-utils', '= 1.1.0'
knife supermarket install search-utils
knife supermarket download search-utils
README
Dependencies
Quality -%

chef-search-utils

chef-search-utils is a chef cookbook that provides several utility functions that make using Chef search easier. By default, searches are restricted to the current environment, and make use of partial_search so that searches use a minimum of resources.

Requirements

Uses the partial_search cookbook.

Usage

Depend on this cookbook in your cookbooks metadata.rb:

depends 'search-utils'

The search_* functions will now be availible in recipes:

# A single FQDN, raising an error if no nodes or multiple nodes are found
chef_server_host = search_fqdn(:recipe => 'chef-server')

# A list of FQDNs matching nodes with the 'postgres' recipe
database_hosts = search_fqdns(:recipe => 'postgres')

# A list of nodes with the 'webserver' role
webservers = search_nodes(:role => 'webserver')

The functions can also be used from template resources and templates:

template "/tmp/test" do
    variables({
        :database_servers => search_fqdns(:role => 'my_database_role')
    })
end
<%= search_fqdn(:recipe => 'find-dev') %>

All of the node search functions restrict searches to the current chef_environment. If you need to search across all environments, use :chef_environment => *.

Functions

search_to_string

search_to_string(:recipe => 'chef-client', :chef_environment => 'staging')
=> "recipe:chef-client AND chef_environment:staging"

search_nodes

Equivalent to partial_search, with :chef_environment set to node.chef_environment by default.

search_nodes({:recipe => 'chef-server'}, {:keys => {"fqdn" => ['fqdn']}})

search_fqdns

Does a partial search, only fetching the FQDNs of matching nodes.

search_fqdns(:recipe => 'webserver')
=> ['one.example.com', 'two.example.com']

search_fqdn

Returns the FQDN of the single matching node, raising an error if zero or multiple nodes match:

search_fqdn(:role => 'graphite')
=> 'graphite.example.com'

Licence

Copyright (c) 2014 Sam Clements

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Authors

Dependent cookbooks

partial_search >= 0.0.0

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

No quality metric results found