Method: Chef::Knife::NodeRunListAdd#run

Defined in:
lib/chef/knife/node_run_list_add.rb

#runObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/chef/knife/node_run_list_add.rb', line 37

def run
  node = Chef::Node.load(@name_args[0])
  if @name_args.size > 2
    # Check for nested lists and create a single plain one
    entries = @name_args[1..-1].map do |entry|
      entry.split(',').map { |e| e.strip }
    end.flatten
  else
    # Convert to array and remove the extra spaces
    entries = @name_args[1].split(',').map { |e| e.strip }
  end

  add_to_run_list(node, entries, config[:after])

  node.save

  config[:run_list] = true

  output(format_for_display(node))
end