Class: Tinychef::NodeRun

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

Constant Summary collapse

OPTIONS_ERROR =
<<-EOH
Required arguments:

  NODE:     node file to execute
  DEST:     ssh username@host string to use to connect to host.
            If missing, this is guessed by the node file name.
  RUN_LIST: an optional RUN_LIST to be passed to chef-solo executable.

EOH
RECIPES_DIR =
"recipes"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ NodeRun

Returns a new instance of NodeRun.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/tinychef/node_run.rb', line 22

def initialize(options)
  node     = options[:node]
  dest     = options[:dest]
  run_list = options[:run_list]

  @node = Tinychef::Node.new(node)
  @dest = Tinychef::Destination.new(dest || @node.host)

  @run_list = run_list

  prepare_run_list_command

rescue => e
  raise OptionsError.new NodeRun::OPTIONS_ERROR
end

Instance Attribute Details

#destObject (readonly)

Returns the value of attribute dest.



20
21
22
# File 'lib/tinychef/node_run.rb', line 20

def dest
  @dest
end

#nodeObject (readonly)

Returns the value of attribute node.



20
21
22
# File 'lib/tinychef/node_run.rb', line 20

def node
  @node
end

#run_listObject (readonly)

Returns the value of attribute run_list.



20
21
22
# File 'lib/tinychef/node_run.rb', line 20

def run_list
  @run_list
end

#run_list_commandObject (readonly)

Returns the value of attribute run_list_command.



20
21
22
# File 'lib/tinychef/node_run.rb', line 20

def run_list_command
  @run_list_command
end

Instance Method Details

#startObject



38
39
40
41
42
43
# File 'lib/tinychef/node_run.rb', line 38

def start
  sync_files
  ensure_remote_data_bag_file_exits
  run_code
  remove_files
end