[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5
Dominic Cleal
dcleal at redhat.com
Tue May 10 08:13:41 UTC 2011
The following commit has been merged in the experimental branch:
commit f8c2f1afa4a9ef71681a96b83b2abdc303a4b0bf
Author: Dominic Cleal <dcleal at redhat.com>
Date: Wed Apr 13 09:44:04 2011 +0100
(#4258) Stop file and config checks from breaking spec
Moved all file and config checks into healthcheck method which is then stubbed
in the spec.
diff --git a/lib/puppet/provider/package/pkgutil.rb b/lib/puppet/provider/package/pkgutil.rb
index 08d74df..760ce01 100755
--- a/lib/puppet/provider/package/pkgutil.rb
+++ b/lib/puppet/provider/package/pkgutil.rb
@@ -6,19 +6,12 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d
pkguti = "/opt/csw/bin/pkgutil"
end
- pkgutilconf = File.open("/etc/opt/csw/pkgutil.conf")
- correct_wgetopts = false
- pkgutilconf.each {|line| correct_wgetopts = true if line =~ /^\s*wgetopts\s*=.*-nv/ }
- if ! correct_wgetopts
- Puppet.notice "It is highly recommended that you set 'wgetopts=-nv' in your pkgutil.conf."
- end
-
confine :operatingsystem => :solaris
commands :pkguti => pkguti
- def self.extended(mod)
- unless command(:pkguti) != "pkgutil"
+ def self.healthcheck()
+ if pkguti == "pkgutil"
raise Puppet::Error,
"The pkgutil command is missing; pkgutil packaging unavailable"
end
@@ -27,9 +20,18 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d
Puppet.notice "It is highly recommended you create '/var/opt/csw/pkgutil/admin'."
Puppet.notice "See /var/opt/csw/pkgutil"
end
+
+ pkgutilconf = File.open("/etc/opt/csw/pkgutil.conf")
+ correct_wgetopts = false
+ pkgutilconf.each {|line| correct_wgetopts = true if line =~ /^\s*wgetopts\s*=.*-nv/ }
+ if ! correct_wgetopts
+ Puppet.notice "It is highly recommended that you set 'wgetopts=-nv' in your pkgutil.conf."
+ end
end
def self.instances(hash = {})
+ healthcheck
+
# Use the available pkg list (-a) to work out aliases
aliases = {}
availlist.each do |pkg|
diff --git a/spec/unit/provider/package/pkgutil_spec.rb b/spec/unit/provider/package/pkgutil_spec.rb
index 4f0e0cc..f1d21f4 100755
--- a/spec/unit/provider/package/pkgutil_spec.rb
+++ b/spec/unit/provider/package/pkgutil_spec.rb
@@ -9,6 +9,9 @@ describe provider do
@resource = stub 'resource'
@resource = Puppet::Type.type(:package).new(:name => "TESTpkg", :ensure => :present)
@provider = provider.new(@resource)
+
+ # Stub all file and config tests
+ provider.stubs(:healthcheck)
end
it "should have an install method" do
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list