Skip to content

Commit

Permalink
Fixed easy_install package provider to use supplied options.
Browse files Browse the repository at this point in the history
  • Loading branch information
leinster authored and btm committed Jun 4, 2011
1 parent 627b643 commit 1ee0ae9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
4 changes: 2 additions & 2 deletions chef/lib/chef/provider/package/easy_install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ 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)
install_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)
Expand Down
18 changes: 17 additions & 1 deletion chef/spec/unit/provider/package/easy_install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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\""
Expand All @@ -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"
Expand Down

0 comments on commit 1ee0ae9

Please sign in to comment.