Commit 2c42e1d6 authored by Zachary Stevens's avatar Zachary Stevens Committed by Bryan McLellan
Browse files

[CHEF-3489] Permit whitespace in chef-client's -o argument.

parent 07d15b16
...@@ -447,7 +447,10 @@ class Chef ...@@ -447,7 +447,10 @@ class Chef
# Ensures runlist override contains RunListItem instances # Ensures runlist override contains RunListItem instances
def runlist_override_sanity_check! def runlist_override_sanity_check!
@override_runlist = @override_runlist.split(',') if @override_runlist.is_a?(String) # Convert to array and remove whitespace
if @override_runlist.is_a?(String)
@override_runlist = @override_runlist.split(',').map { |e| e.strip }
end
@override_runlist = [@override_runlist].flatten.compact @override_runlist = [@override_runlist].flatten.compact
@override_runlist.map! do |item| @override_runlist.map! do |item|
if(item.is_a?(Chef::RunList::RunListItem)) if(item.is_a?(Chef::RunList::RunListItem))
......
...@@ -239,12 +239,16 @@ shared_examples_for Chef::Client do ...@@ -239,12 +239,16 @@ shared_examples_for Chef::Client do
@node.chef_environment("_default") @node.chef_environment("_default")
@node[:platform] = "example-platform" @node[:platform] = "example-platform"
@node[:platform_version] = "example-platform-1.0" @node[:platform_version] = "example-platform-1.0"
end
@client = Chef::Client.new(nil, :override_runlist => 'role[test_role]') it "should permit spaces in overriding run list" do
@client.node = @node @client = Chef::Client.new(nil, :override_runlist => 'role[a], role[b]')
end end
it "should override the run list and save original runlist" do it "should override the run list and save original runlist" do
@client = Chef::Client.new(nil, :override_runlist => 'role[test_role]')
@client.node = @node
@node.run_list << "role[role_containing_cookbook1]" @node.run_list << "role[role_containing_cookbook1]"
override_role = Chef::Role.new override_role = Chef::Role.new
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment