summaryrefslogtreecommitdiff
path: root/lib/chef/knife/node_run_list_remove.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/knife/node_run_list_remove.rb')
-rw-r--r--lib/chef/knife/node_run_list_remove.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/chef/knife/node_run_list_remove.rb b/lib/chef/knife/node_run_list_remove.rb
index 8519fd590a..4b8953a264 100644
--- a/lib/chef/knife/node_run_list_remove.rb
+++ b/lib/chef/knife/node_run_list_remove.rb
@@ -27,11 +27,20 @@ class Chef
require 'chef/json_compat'
end
- banner "knife node run_list remove [NODE] [ENTRIES] (options)"
+ banner "knife node run_list remove [NODE] [ENTRY[,ENTRY]] (options)"
def run
node = Chef::Node.load(@name_args[0])
- entries = @name_args[1].split(',')
+
+ 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
entries.each { |e| node.run_list.remove(e) }
@@ -45,4 +54,3 @@ class Chef
end
end
end
-