[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. puppet-0.24.5-rc3-1601-gf8c1b08
James Turnbull
james at lovedthanlost.net
Fri Jan 15 09:07:52 UTC 2010
The following commit has been merged in the upstream branch:
commit f5960ce2bde4af9af1af8bdf106e83d21afacb5c
Author: James Turnbull <james at lovedthanlost.net>
Date: Sun Dec 13 08:41:11 2009 +1100
Closed #2937 - Migrated a number of requires to features
diff --git a/lib/puppet/application/puppetrun.rb b/lib/puppet/application/puppetrun.rb
index 2dbd803..41ebf9f 100644
--- a/lib/puppet/application/puppetrun.rb
+++ b/lib/puppet/application/puppetrun.rb
@@ -1,18 +1,9 @@
-begin
- require 'rubygems'
-rescue LoadError
- # Nothing; we were just doing this just in case
-end
-
-begin
- require 'ldap'
-rescue LoadError
- $stderr.puts "Failed to load ruby LDAP library. LDAP functionality will not be available"
-end
-
require 'puppet'
require 'puppet/application'
+Puppet.warning "RubyGems not installed" unless Puppet.features.rubygems?
+Puppet.warning "Failed to load ruby LDAP library. LDAP functionality will not be available" unless Puppet.features.ldap?
+
Puppet::Application.new(:puppetrun) do
should_not_parse_config
diff --git a/lib/puppet/feature/base.rb b/lib/puppet/feature/base.rb
index c3fb9a2..aac04f2 100644
--- a/lib/puppet/feature/base.rb
+++ b/lib/puppet/feature/base.rb
@@ -28,3 +28,6 @@ Puppet.features.add(:augeas, :libs => ["augeas"])
# We have RRD available
Puppet.features.add(:rrd, :libs => ["RRDtool"])
+
+# We have OpenSSL
+Puppet.features.add(:openssl, :libs => ["openssl"])
diff --git a/lib/puppet/feature/selinux.rb b/lib/puppet/feature/selinux.rb
new file mode 100644
index 0000000..84be239
--- /dev/null
+++ b/lib/puppet/feature/selinux.rb
@@ -0,0 +1,3 @@
+require 'puppet/util/feature'
+
+Puppet.features.add(:selinux, :libs => ["selinux"])
diff --git a/lib/puppet/sslcertificates.rb b/lib/puppet/sslcertificates.rb
index fb5c1b7..62cfad1 100755
--- a/lib/puppet/sslcertificates.rb
+++ b/lib/puppet/sslcertificates.rb
@@ -2,11 +2,7 @@
require 'puppet'
-begin
- require 'openssl'
-rescue LoadError
- raise Puppet::Error, "You must have the Ruby openssl library installed"
-end
+raise Puppet::Error, "You must have the Ruby openssl library installed" unless Puppet.features.openssl?
module Puppet::SSLCertificates
#def self.mkcert(type, name, dnsnames, ttl, issuercert, issuername, serial, publickey)
diff --git a/lib/puppet/util/selinux.rb b/lib/puppet/util/selinux.rb
index f1336f9..331c8eb 100644
--- a/lib/puppet/util/selinux.rb
+++ b/lib/puppet/util/selinux.rb
@@ -7,11 +7,7 @@
# was abysmal. At this time (2008-11-02) the only distribution providing
# these Ruby SELinux bindings which I am aware of is Fedora (in libselinux-ruby).
-begin
- require 'selinux'
-rescue LoadError
- # Nothing
-end
+Puppet.warning "SELinux not installed" unless Puppet.features.selinux?
require 'pathname'
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list