Class: Rundock::Builder::TargetBuilder
- Defined in:
- lib/rundock/builder/target_builder.rb
Constant Summary collapse
- TargetNoSupportError =
Class.new(NotImplementedError)
- TargetGroupNotFoundError =
Class.new(StandardError)
Constants inherited from Base
Base::BuilderNotImplementedError
Instance Attribute Summary collapse
-
#parsed_node_options ⇒ Object
Returns the value of attribute parsed_node_options.
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Rundock::Builder::Base
Instance Attribute Details
#parsed_node_options ⇒ Object
Returns the value of attribute parsed_node_options.
7 8 9 |
# File 'lib/rundock/builder/target_builder.rb', line 7 def end |
Instance Method Details
#build(target_name, target_info) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rundock/builder/target_builder.rb', line 9 def build(target_name, target_info) # host type specified if target not found. if target_info.nil? || !target_info.key?(target_name.to_sym) || !target_info[target_name.to_sym].key?(:target_type) || target_info[target_name.to_sym][:target_type] == 'host' backend_builder = BackendBuilder.new(, target_name, target_info) backend = backend_builder.build = { target_name.to_sym => backend_builder. } else raise TargetNoSupportError end Node.new(target_name, backend) end |
#build_group(target_group_name, target_info) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rundock/builder/target_builder.rb', line 26 def build_group(target_group_name, target_info) if !target_info.nil? && target_info.key?(target_group_name.to_sym) && target_info[target_group_name.to_sym][:target_type] == 'group' && target_info[target_group_name.to_sym].key?(:targets) && target_info[target_group_name.to_sym][:targets].is_a?(Array) targets = target_info[target_group_name.to_sym][:targets] nodes = [] = {} targets.each do |n| backend_builder = BackendBuilder.new(, n, target_info) backend = backend_builder.build [n.to_sym] = backend_builder. nodes << Node.new(n, backend) end nodes else raise TargetGroupNotFoundError end end |