lib/rundock/builder/operation_builder.rb in rundock-0.3.0 vs lib/rundock/builder/operation_builder.rb in rundock-0.4.0

- old
+ new

@@ -19,20 +19,23 @@ scen.nodes.push(node) if node n.deep_symbolize_keys.each do |k, v| if k == :node node_attribute.finalize_node - builder = BackendBuilder.new(@options, v, node_info) - backend = builder.build + backend_builder = BackendBuilder.new(@options, v, node_info) + backend = backend_builder.build node = Node.new(v, backend) node_attribute.nodename = v - scen.node_info[v.to_sym] = node_attribute.nodeinfo = builder.parsed_options + scen.node_info[v.to_sym] = node_attribute.nodeinfo = backend_builder.parsed_options if @options[:command] node.add_operation(build_cli_command_operation(@options[:command], node_attribute, @options)) end + elsif k == :hook + node_attribute.enable_hooks = Array(v) + node.hooks = HookBuilder.new(@options).build(Array(v)) if node else next unless node ope = build_operations(k, Array(v), node_attribute, @options) @@ -45,10 +48,11 @@ scen.complete end def build_task(tasks, backend, node_attribute) node = Node.new(node_attribute.nodename, backend) + node.hooks = HookBuilder.new(nil).build_from_attributes(node_attribute.nodeinfo) scen = Scenario.new tasks.each do |k, v| ope = build_operations(k, Array(v), node_attribute, nil) node.add_operation(ope) if ope @@ -62,9 +66,10 @@ scen = Scenario.new @options[:host].split(',').each do |host| backend = BackendBuilder.new(@options, host, nil).build node = Node.new(host, backend) + node.hooks = HookBuilder.new(@options).build(['all']) node.add_operation( build_cli_command_operation(@options[:command], Rundock::Attribute::NodeAttribute.new, @options)) scen.nodes.push(node) end