Skip to content

Commit 02cae68

Browse files
committed
Merge branch 'CHEF-988' of git://github.com/thommay/chef into thommay/CHEF-988
2 parents b6f1b78 + 7259a99 commit 02cae68

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

‎chef/lib/chef/provider/package/yum.rb‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,11 @@ def install_package(name, version)
140140
end
141141

142142
defupgrade_package(name,version)
143-
# If we have a version, we can upgrade - otherwise, install
144-
if@current_resource.version
143+
# If we're not given a version, running update is the correct
144+
# option. If we are, then running install_package is right.
145+
unlessversion
145146
run_command_with_systems_locale(
146-
:command=>"yum -d0 -e0 -y update #{name}-#{version}"
147+
:command=>"yum -d0 -e0 -y update #{name}"
147148
)
148149
@yum.flush
149150
else

‎chef/spec/unit/provider/package/yum_spec.rb‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,16 @@
142142
@provider.current_resource=@current_resource
143143
end
144144

145-
it"should run yum update if the package is installed"do
145+
it"should run yum update if the package is installed and no version is given"do
146146
@provider.should_receive(:run_command_with_systems_locale).with({
147-
:command=>"yum -d0 -e0 -y update emacs-11"
147+
:command=>"yum -d0 -e0 -y update emacs"
148+
})
149+
@provider.upgrade_package(@new_resource.name,nil)
150+
end
151+
152+
it"should run yum install if the package is installed and a version is given"do
153+
@provider.should_receive(:run_command_with_systems_locale).with({
154+
:command=>"yum -d0 -e0 -y install emacs-11"
148155
})
149156
@provider.upgrade_package(@new_resource.name,@provider.candidate_version)
150157
end

0 commit comments

Comments
(0)