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

RSS

discovery (16) Versions 0.2.2

Installs/Configures the discovery library

Policyfile
Berkshelf
Knife
cookbook 'discovery', '~> 0.2.2', :supermarket
cookbook 'discovery', '~> 0.2.2'
knife supermarket install discovery
knife supermarket download discovery
README
Dependencies
Quality 33%

Discovery Library

You can use the #search method to locate a role, optionally
restricted to the environment.

It will fall back to searching the local nodes run_list for roles, so
you can have less logic flow in recipes.

host = Discovery.search("any_role",
                        :node => node,
                        :environment_aware => false)

All

You can use the #all method to locate all nodes with a role,
optionally restricted to the environment.

Additional options:

hosts = Discovery.all("base",
                      :node => node,
                      :environment_aware => true,
                      :empty_ok => false,
                      :remove_self => true,
                      :minimum_response_time => false)

ipaddress

You can use the #ipaddress method to automatically grab a prioritised
ipaddress from a node.

The remote node will be compared against the same node, if any are in
any clouds detected by ohai (and they are in the same cloud) the local
ipv4 will be returned.

You can optionally supply a type argument specifying which ipaddress
you would like.

ipaddress = Discovery.ipaddress(:remote_node => host,
                                :node => node)
local_ipv4 = Discovery.ipaddress(:remote_node => host,
                                 :node => node,
                                 :type => :local)
public_ipv4 = Discovery.ipaddress(:remote_node => host,
                                 :node => node,
                                 :type => :public)

Recipe DSL

Recipe DSL versions of the search, all and ipaddress methods are avaialble for the class; using them means you do not need to explicitly pass the node:

  • discovery_search
# Note omission of :node => node 
host = discovery_search("base",
                        :environment_aware => true,
                        :empty_ok => false,
                        :remove_self => true,
                        :minimum_response_time => false)
  • discovery_all
hosts = discovery_all(...)
  • discovery_ipaddress
host = discovery_search(...)
ipaddress = discovery_ipaddress(:remote_node = host)

Perform raw attribute searching instead of just restricting search to
role names:

host = Discovery.search("attr_name:attr_value",
                        :node => node,
                        :environment_aware => false,
                        :raw_search => true)

Collaborator Number Metric
            

0.2.2 passed this metric

Contributing File Metric
            

0.2.2 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
            

0.2.2 failed this metric

FC039: Node method cannot be accessed with key: discovery/libraries/search.rb:82
FC039: Node method cannot be accessed with key: discovery/libraries/search.rb:83
FC039: Node method cannot be accessed with key: discovery/libraries/search.rb:84
FC039: Node method cannot be accessed with key: discovery/libraries/search.rb:101
FC064: Ensure issues_url is set in metadata: discovery/metadata.rb:1
FC065: Ensure source_url is set in metadata: discovery/metadata.rb:1
FC066: Ensure chef_version is set in metadata: discovery/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: discovery/metadata.rb:1
FC069: Ensure standardized license defined in metadata: discovery/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

No Binaries Metric
            

0.2.2 passed this metric

Testing File Metric
            

0.2.2 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
            

0.2.2 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