summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorDominic Cleal <dcleal@redhat.com>2011-04-13 09:44:04 +0100
committerDominic Cleal <dcleal@redhat.com>2011-04-13 09:44:04 +0100
commitf8c2f1afa4a9ef71681a96b83b2abdc303a4b0bf (patch)
tree7383a86bdabe195a86ef940f1a82513ed39eff20 /lib/puppet
parentef86105215a00f428e9cdc251b6a29b8e11487bb (diff)
downloadpuppet-f8c2f1afa4a9ef71681a96b83b2abdc303a4b0bf.tar.gz
puppet-f8c2f1afa4a9ef71681a96b83b2abdc303a4b0bf.tar.xz
puppet-f8c2f1afa4a9ef71681a96b83b2abdc303a4b0bf.zip
(#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.
Diffstat (limited to 'lib/puppet')
-rwxr-xr-xlib/puppet/provider/package/pkgutil.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/puppet/provider/package/pkgutil.rb b/lib/puppet/provider/package/pkgutil.rb
index 08d74df29..760ce01db 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|