Method: Rbeapi::Client.connect_to

Defined in:
lib/rbeapi/client.rb

.connect_to(name) ⇒ Rbeapi::Node?

Retrieves the node config form the loaded configuration file and returns a Rbeapi::Node instance for working with the remote node.

Parameters:

  • :name (String)

    The named configuration to use for creating the connection to the remote node

Returns:

  • (Rbeapi::Node, nil)

    Returns an instance of Rbeapi::Node. If the named configuration is not found then nil is returned



103
104
105
106
107
108
109
# File 'lib/rbeapi/client.rb', line 103

def connect_to(name)
  config = config_for(name)
  return nil unless config
  config = Rbeapi::Utils.transform_keys_to_symbols(config)
  connection = connect config
  Node.new(connection)
end