summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-06-13 21:23:58 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-06-13 21:23:58 +0000
commit1dfd55408d3a9f5c609ee562d0e948c15c5629fb (patch)
tree617a1b21372c610b4ad3f79e7d7b89ae33bd1365
parentdf340d6cd176f375df94e35ed2efc48b622348f2 (diff)
downloadpuppet-1dfd55408d3a9f5c609ee562d0e948c15c5629fb.tar.gz
puppet-1dfd55408d3a9f5c609ee562d0e948c15c5629fb.tar.xz
puppet-1dfd55408d3a9f5c609ee562d0e948c15c5629fb.zip
Fixing packaging to deal with the fact that yum exits with 0 exit code even when it is told to install a non-existent package.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1263 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r--lib/puppet/type/package.rb7
-rw-r--r--test/types/package.rb5
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/puppet/type/package.rb b/lib/puppet/type/package.rb
index 073336b20..8c9458372 100644
--- a/lib/puppet/type/package.rb
+++ b/lib/puppet/type/package.rb
@@ -133,13 +133,18 @@ module Puppet
@parent[:type]
)
end
+
+ # Because yum always exits with a 0 exit code, there's a retrieve
+ # in the "install" method. So, check the current state now,
+ # to compare against later.
+ current = self.is
begin
@parent.update
rescue => detail
self.fail "Could not update: %s" % detail
end
- if self.is == :absent
+ if current == :absent
return :package_created
else
return :package_changed
diff --git a/test/types/package.rb b/test/types/package.rb
index 1c18fa628..3e76960b4 100644
--- a/test/types/package.rb
+++ b/test/types/package.rb
@@ -196,7 +196,8 @@ class TestPackages < Test::Unit::TestCase
mkpkgs { |pkg|
next unless pkg.respond_to? :latest
assert_nothing_raised {
- assert(pkg.latest, "Package did not return value for 'latest'")
+ assert(pkg.latest,
+ "Package %s did not return value for 'latest'" % pkg.name)
}
}
end
@@ -224,7 +225,7 @@ class TestPackages < Test::Unit::TestCase
pkg.retrieve
}
- if pkg.insync?
+ if pkg.insync? or pkg.is(:ensure) != :absent
Puppet.notice "Test package %s is already installed; please choose a different package for testing" % pkg
next
end