~ubuntu-branches/ubuntu/trusty/puppet/trusty

« back to all changes in this revision

Viewing changes to lib/puppet/feature/base.rb

  • Committer: Package Import Robot
  • Author(s): Stig Sandbeck Mathisen
  • Date: 2011-10-22 14:08:22 UTC
  • mfrom: (1.1.25) (3.1.32 sid)
  • Revision ID: package-import@ubuntu.com-20111022140822-odxde5lohc45yhuz
Tags: 2.7.6-1
* New upstream release (CVE-2011-3872)
* Remove cherry-picked "groupadd_aix_warning" patch
* Install all new manpages

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#  Created by Luke Kanies on 2006-04-30.
2
 
#  Copyright (c) 2006. All rights reserved.
3
 
 
4
1
require 'puppet/util/feature'
5
2
 
6
3
# Add the simple features, all in one file.
7
4
 
 
5
# Order is important as some features depend on others
 
6
 
 
7
# We have a syslog implementation
 
8
Puppet.features.add(:syslog, :libs => ["syslog"])
 
9
 
 
10
# We can use POSIX user functions
 
11
Puppet.features.add(:posix) do
 
12
  require 'etc'
 
13
  Etc.getpwuid(0) != nil && Puppet.features.syslog?
 
14
end
 
15
 
 
16
# We can use Microsoft Windows functions
 
17
Puppet.features.add(:microsoft_windows) do
 
18
  begin
 
19
    require 'sys/admin'
 
20
    require 'win32/process'
 
21
    require 'win32/dir'
 
22
    require 'win32/service'
 
23
    require 'win32ole'
 
24
    require 'win32/api'
 
25
    true
 
26
  rescue LoadError => err
 
27
    warn "Cannot run on Microsoft Windows without the sys-admin, win32-process, win32-dir & win32-service gems: #{err}" unless Puppet.features.posix?
 
28
  end
 
29
end
 
30
 
 
31
raise Puppet::Error,"Cannot determine basic system flavour" unless Puppet.features.posix? or Puppet.features.microsoft_windows?
 
32
 
8
33
# We've got LDAP available.
9
34
Puppet.features.add(:ldap, :libs => ["ldap"])
10
35
 
33
58
# We have OpenSSL
34
59
Puppet.features.add(:openssl, :libs => ["openssl"])
35
60
 
36
 
# We have a syslog implementation
37
 
Puppet.features.add(:syslog, :libs => ["syslog"])
38
 
 
39
 
# We can use POSIX user functions
40
 
Puppet.features.add(:posix) do
41
 
  require 'etc'
42
 
  Etc.getpwuid(0) != nil && Puppet.features.syslog?
43
 
end
44
 
 
45
 
# We can use Microsoft Windows functions
46
 
Puppet.features.add(:microsoft_windows, :libs => ["sys/admin", "win32/process", "win32/dir"])
47
 
 
48
 
raise Puppet::Error,"Cannot determine basic system flavour" unless Puppet.features.posix? or Puppet.features.microsoft_windows?
49
 
 
50
61
# We have CouchDB
51
62
Puppet.features.add(:couchdb, :libs => ["couchrest"])
52
63