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

RSS

alternate_search (3) Versions 2.3.0

An alternate search syntax for Chef

Berkshelf/Librarian
Policyfile
Knife
cookbook 'alternate_search', '~> 2.3.0'
cookbook 'alternate_search', '~> 2.3.0', :supermarket
knife cookbook site install alternate_search
knife cookbook site download alternate_search
README
Dependencies
Quality 33%

alternate_search

alternate_search is a chef cookbook that provides an alternate search syntax (and 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 'alternate_search'

The below functions can the be used in recipes and template resources.

Functions

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

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')

Options for partial_search can be passed as a second parameter:

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'

Examples

Searching from a recipe:

# 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')

Searching from a template resource:

template "/tmp/test" do
    variables({
        :database_servers => search_fqdns(:role => 'my_database_role')
    })
end

Licence

Copyright (c) 2014 DataSift opensource@datasift.com

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

Written by Sam Clements at DataSift.

Sam Clements DataSift

Dependent cookbooks

partial_search >= 0.0.0

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

Collaborator Number Metric
            

2.3.0 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

2.3.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Foodcritic Metric
            

2.3.0 failed this metric

FC064: Ensure issues_url is set in metadata: alternate_search/metadata.rb:1
FC065: Ensure source_url is set in metadata: alternate_search/metadata.rb:1
FC066: Ensure chef_version is set in metadata: alternate_search/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: alternate_search/metadata.rb:1
FC069: Ensure standardized license defined in metadata: alternate_search/metadata.rb:1
Run with Foodcritic Version 12.2.1 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

License Metric
            

2.3.0 passed this metric

No Binaries Metric
            

2.3.0 passed this metric

Publish Metric
            

2.3.0 passed this metric

Supported Platforms Metric
            

2.3.0 failed this metric

alternate_search should declare what platform(s) it supports.

Testing File Metric
            

2.3.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

2.3.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number