diff --git a/chef/lib/chef/provider/package/easy_install.rb b/chef/lib/chef/provider/package/easy_install.rb index 64723db938a..6c9dacc55d9 100644 --- a/chef/lib/chef/provider/package/easy_install.rb +++ b/chef/lib/chef/provider/package/easy_install.rb @@ -115,7 +115,7 @@ def candidate_version end def install_package(name, version) - run_command(:command => "#{easy_install_binary_path} \"#{name}==#{version}\"") + run_command(:command => "#{easy_install_binary_path}#{expand_options(@new_resource.options)} \"#{name}==#{version}\"") end def upgrade_package(name, version) @@ -123,7 +123,7 @@ def upgrade_package(name, version) end def remove_package(name, version) - run_command(:command => "#{easy_install_binary_path} -m #{name}") + run_command(:command => "#{easy_install_binary_path }#{expand_options(@new_resource.options)} -m #{name}") end def purge_package(name, version) diff --git a/chef/spec/unit/provider/package/easy_install_spec.rb b/chef/spec/unit/provider/package/easy_install_spec.rb index 57c0044d3f0..4bb0dcf9cef 100644 --- a/chef/spec/unit/provider/package/easy_install_spec.rb +++ b/chef/spec/unit/provider/package/easy_install_spec.rb @@ -38,7 +38,7 @@ @pid = 2342 @provider.stub!(:popen4).and_return(@status) end - + describe "easy_install_binary_path" do it "should return a Chef::Provider::EasyInstall object" do @@ -70,6 +70,14 @@ @provider.install_package("boto", "1.8d") end + it "should run easy_install with the package name and version and specified options" do + @provider.should_receive(:run_command).with({ + :command => "easy_install --always-unzip \"boto==1.8d\"" + }) + @new_resource.stub!(:options).and_return("--always-unzip") + @provider.install_package("boto", "1.8d") + end + it "should run easy_install with the package name and version" do @provider.should_receive(:run_command).with({ :command => "easy_install \"boto==1.8d\"" @@ -84,6 +92,14 @@ @provider.remove_package("boto", "1.8d") end + it "should run easy_install -m with the package name and version and specified options" do + @provider.should_receive(:run_command).with({ + :command => "easy_install -x -m boto" + }) + @new_resource.stub!(:options).and_return("-x") + @provider.remove_package("boto", "1.8d") + end + it "should run easy_install -m with the package name and version" do @provider.should_receive(:run_command).with({ :command => "easy_install -m boto"