Module: Spice::Connection::Nodes

Included in:
Spice, Spice::Connection
Defined in:
lib/spice/connection/nodes.rb

Instance Method Summary (collapse)

Instance Method Details

- (Spice::Node) node(name)

Retrieve a single client

Examples:

Retrieve the node named "app.example.com"

Spice.node("app.example.com")

Parameters:

  • name (String)

    The node name

Returns:

Raises:



22
23
24
25
# File 'lib/spice/connection/nodes.rb', line 22

def node(name)
  node_attributes = connection.get("/nodes/#{name}").body
  Spice::Node.new(node_attributes)
end

- (Array<Spice::Node>) nodes(options = {})

A collection of nodes

Examples:

Retrieve all nodes that have the role "base"

Spice.nodes(:q => "roles:base")

Retrieve nodes with role "base" in the "production" environment

Spice.nodes(:q => "roles:base AND environment:production")

Parameters:

  • options (Hash) (defaults to: {})

    An options hash that is passed to Search#search

Returns:

See Also:



12
13
14
# File 'lib/spice/connection/nodes.rb', line 12

def nodes(options={})
  connection.search('node', options)
end