module IIB::Node

Public Class Methods

create_local_node(name) click to toggle source
# File lib/iib/node.rb, line 43
def self.create_local_node(name)
  IIB.check_local_iib_environment

  iib_create_broker = Mixlib::ShellOut.new("iib createbroker #{name}")
  iib_create_broker.run_command

  return IIB::Node.new(type: :CLI, name: name)
end
delete_local_node(name) click to toggle source
# File lib/iib/node.rb, line 52
def self.delete_local_node(name)
  IIB.check_local_iib_environment

  iib_delete_broker = Mixlib::ShellOut.new("iib deletebroker #{name}")

  iib_delete_broker.run_command
end
get_all_local_nodes() click to toggle source
# File lib/iib/node.rb, line 29
def self.get_all_local_nodes
  IIB.check_local_iib_environment

  iib_list = Mixlib::ShellOut.new("iib list -d 0")
  iib_list.run_command

  output = iib_list.stdout
  matches = output.scan(/BIP8099I:\ Broker:\ ([^\ ]*)\ \ -\ \ ([^\n]*)/m)

  matches.map do |match|
    IIB::Node.new(type: :CLI,name: match[0])
  end
end
new(options) click to toggle source
# File lib/iib/node.rb, line 24
def self.new(options)
  return IIB::Node::REST.new(options) if options.has_key?(:hostname)
  return IIB::Node::CLI.new(options)  if options.has_key?(:name)
end