Class: FlumeMaster

Inherits:
Object
  • Object
show all
Defined in:
lib/flume_master.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ FlumeMaster

Returns a new instance of FlumeMaster.



6
7
8
9
10
11
# File 'lib/flume_master.rb', line 6

def initialize(opts)
  @connection = SSHConnection.new({ :host => opts[:host], 
                                     :username => opts[:username], 
                                     :password => opts[:password]})
  @connection.debug = true if opts[:debug] == true
end

Instance Method Details

#apply(config) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/flume_master.rb', line 13

def apply(config)
  config.logical_nodes.each do |logical_node_command|
    execute logical_node_command
  end
  
  config.node_configurations.each do |config|
    config = config.gsub("\"", "\\\"")
    execute "flume shell -c localhost -e \"exec multiconfig '#{config}'\""
  end
end

#decommission(nodes) ⇒ Object



24
25
26
27
28
29
# File 'lib/flume_master.rb', line 24

def decommission(nodes)
  nodes.each do |node|
    execute "flume shell -c localhost -e 'exec decommission #{node}'"
    execute "flume shell -c localhost -e 'exec purge #{node}'"
  end
end