summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnshul Sharma <justanshulsharma@gmail.com>2014-10-16 06:36:38 +0530
committerAnshul Sharma <justanshulsharma@gmail.com>2014-10-16 06:36:38 +0530
commit9bb4f151766d43b73a16cc14408f96c3555a2bf4 (patch)
treeecf6f168032ee42f9524ccc39f637e4c21be4635
parentd3150dcf413e96a5140e0e30ac94698e159632a9 (diff)
downloadchef-9bb4f151766d43b73a16cc14408f96c3555a2bf4.tar.gz
knife node run_list remove issue #2186
fixes "knife node run_list remove" issue #2186
-rw-r--r--lib/chef/knife/node_run_list_remove.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/chef/knife/node_run_list_remove.rb b/lib/chef/knife/node_run_list_remove.rb
index 8519fd590a..2052ee6f1a 100644
--- a/lib/chef/knife/node_run_list_remove.rb
+++ b/lib/chef/knife/node_run_list_remove.rb
@@ -1,3 +1,6 @@
+
+
+
#
# Author:: Adam Jacob (<adam@opscode.com>)
# Copyright:: Copyright (c) 2009 Opscode, Inc.
@@ -31,7 +34,16 @@ class Chef
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 +57,3 @@ class Chef
end
end
end
-