Class: Rundock::Builder::BackendBuilder

Inherits:
Base show all
Defined in:
lib/rundock/builder/backend_builder.rb

Constant Summary

Constants inherited from Base

Rundock::Builder::Base::BuilderNotImplementedError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, nodename, node_info) ⇒ BackendBuilder

Returns a new instance of BackendBuilder.



6
7
8
9
10
# File 'lib/rundock/builder/backend_builder.rb', line 6

def initialize(options, nodename, node_info)
  super(options)
  @nodename = nodename
  @node_info = node_info
end

Instance Attribute Details

#parsed_optionsObject

Returns the value of attribute parsed_options.



4
5
6
# File 'lib/rundock/builder/backend_builder.rb', line 4

def parsed_options
  @parsed_options
end

Instance Method Details

#buildObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/rundock/builder/backend_builder.rb', line 12

def build
  @parsed_options = build_options

  backend_type = parse_backend_type

  @parsed_options.merge!(@options)

  # update ssh options for node from node_info
  @parsed_options.merge!(@node_info[@nodename.to_sym][:ssh_opts])

  # delete trash ssh_options(node[host::ssh_options])
  @node_info[@nodename.to_sym].delete(:ssh_opts)

  # add any attributes for host from node_info
  @parsed_options.merge!(@node_info[@nodename.to_sym])

  Backend.create(backend_type, @parsed_options)
end