diff options
author | Adam Jacob <adam@opscode.com> | 2010-02-26 15:56:03 -0800 |
---|---|---|
committer | Adam Jacob <adam@opscode.com> | 2010-02-26 15:56:03 -0800 |
commit | 02cae6853b7b0fd8fc50871371f4ec947631827f (patch) | |
tree | 666e06939b83ea25f1fce6d8816f1a95c2d429f8 | |
parent | b6f1b78c6e40c67d6a46f4edd691ab1a83996c0e (diff) | |
parent | 7259a992e8ce45c476ae4455542690d43f103154 (diff) | |
download | chef-02cae6853b7b0fd8fc50871371f4ec947631827f.tar.gz |
Merge branch 'CHEF-988' of git://github.com/thommay/chef into thommay/CHEF-988
-rw-r--r-- | chef/lib/chef/provider/package/yum.rb | 7 | ||||
-rw-r--r-- | chef/spec/unit/provider/package/yum_spec.rb | 11 |
2 files changed, 13 insertions, 5 deletions
diff --git a/chef/lib/chef/provider/package/yum.rb b/chef/lib/chef/provider/package/yum.rb index eb7ed422dd..df238204e5 100644 --- a/chef/lib/chef/provider/package/yum.rb +++ b/chef/lib/chef/provider/package/yum.rb @@ -140,10 +140,11 @@ class Chef end def upgrade_package(name, version) - # If we have a version, we can upgrade - otherwise, install - if @current_resource.version + # If we're not given a version, running update is the correct + # option. If we are, then running install_package is right. + unless version run_command_with_systems_locale( - :command => "yum -d0 -e0 -y update #{name}-#{version}" + :command => "yum -d0 -e0 -y update #{name}" ) @yum.flush else diff --git a/chef/spec/unit/provider/package/yum_spec.rb b/chef/spec/unit/provider/package/yum_spec.rb index 37e52639be..fab5d3baa1 100644 --- a/chef/spec/unit/provider/package/yum_spec.rb +++ b/chef/spec/unit/provider/package/yum_spec.rb @@ -142,9 +142,16 @@ describe Chef::Provider::Package::Yum, "upgrade_package" do @provider.current_resource = @current_resource end - it "should run yum update if the package is installed" do + it "should run yum update if the package is installed and no version is given" do @provider.should_receive(:run_command_with_systems_locale).with({ - :command => "yum -d0 -e0 -y update emacs-11" + :command => "yum -d0 -e0 -y update emacs" + }) + @provider.upgrade_package(@new_resource.name, nil) + end + + it "should run yum install if the package is installed and a version is given" do + @provider.should_receive(:run_command_with_systems_locale).with({ + :command => "yum -d0 -e0 -y install emacs-11" }) @provider.upgrade_package(@new_resource.name, @provider.candidate_version) end |