summaryrefslogtreecommitdiffstats
path: root/lib/puppet/provider
diff options
context:
space:
mode:
authorlutter <lutter@980ebf18-57e1-0310-9a29-db15c13687c0>2007-01-05 00:09:36 +0000
committerlutter <lutter@980ebf18-57e1-0310-9a29-db15c13687c0>2007-01-05 00:09:36 +0000
commitf8f7c57b9e10477fc14f6bc655ad194598c91980 (patch)
treef781036be7b5b6e33e65974a43066ad749cebc72 /lib/puppet/provider
parent42c13e27535c868d6b70ba806554197ce3b833dc (diff)
downloadpuppet-f8f7c57b9e10477fc14f6bc655ad194598c91980.tar.gz
puppet-f8f7c57b9e10477fc14f6bc655ad194598c91980.tar.xz
puppet-f8f7c57b9e10477fc14f6bc655ad194598c91980.zip
Don't rely on the type to store the actual NVR of the package; breaks in the provider tests since they call the provider slightly differntly
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2048 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/provider')
-rwxr-xr-xlib/puppet/provider/package/rpm.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/puppet/provider/package/rpm.rb b/lib/puppet/provider/package/rpm.rb
index 7a2dfe53f..1d9fa4d66 100755
--- a/lib/puppet/provider/package/rpm.rb
+++ b/lib/puppet/provider/package/rpm.rb
@@ -4,7 +4,7 @@ Puppet::Type.type(:package).provide :rpm do
binary."
# The query format by which we identify installed packages
- IDSTRING = "%{NAME}-%{VERSION}-%{RELEASE}"
+ NVRFORMAT = "%{NAME}-%{VERSION}-%{RELEASE}"
VERSIONSTRING = "%{VERSION}-%{RELEASE}"
@@ -47,7 +47,7 @@ Puppet::Type.type(:package).provide :rpm do
# a hash with entries :instance => fully versioned package name, and
# :ensure => version-release
def query
- cmd = ["-q", @model[:name], "--qf", "#{IDSTRING} #{VERSIONSTRING}\n"]
+ cmd = ["-q", @model[:name], "--qf", "#{NVRFORMAT} #{VERSIONSTRING}\n"]
begin
output = rpm *cmd
@@ -68,6 +68,8 @@ Puppet::Type.type(:package).provide :rpm do
output
end
+ @nvr = hash[:instance]
+
return hash
end
@@ -103,7 +105,7 @@ Puppet::Type.type(:package).provide :rpm do
end
def uninstall
- rpm "-e", @model[:instance]
+ rpm "-e", nvr
end
def update
@@ -113,6 +115,11 @@ Puppet::Type.type(:package).provide :rpm do
def versionable?
true
end
+
+ def nvr
+ query unless @nvr
+ @nvr
+ end
end
# $Id$