From 1645d8e7ca87939bf87e7a5af143af223be71b2a Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Tue, 11 May 2010 17:03:14 +0200 Subject: Define posix and win32 features --- lib/puppet/feature/base.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/puppet') diff --git a/lib/puppet/feature/base.rb b/lib/puppet/feature/base.rb index 1971f14f2..44a9f3fc1 100644 --- a/lib/puppet/feature/base.rb +++ b/lib/puppet/feature/base.rb @@ -31,3 +31,14 @@ Puppet.features.add(:rrd, :libs => ["RRDtool"]) # We have OpenSSL Puppet.features.add(:openssl, :libs => ["openssl"]) + +# We can use POSIX user functions? The require returns false on Windows +Puppet.features.add(:posix) do + require 'etc' + Etc.getpwuid(0) != nil +end + +# We can use Win32 functions +Puppet.features.add(:win32, :libs => ["sys/admin", "win32/process"]) + +raise Puppet::Error "Cannot determine basic system flavour" unless Puppet.features.posix? or Puppet.features.win32? -- cgit