Module: Puppet::Util::Platform

Defined in:
lib/puppet/util/platform.rb

Constant Summary collapse

FIPS_STATUS_FILE =
"/proc/sys/crypto/fips_enabled".freeze
WINDOWS_FIPS_REGISTRY_KEY =
'System\\CurrentControlSet\\Control\\Lsa\\FipsAlgorithmPolicy'.freeze

Class Method Summary collapse

Class Method Details

.default_pathsObject


17
18
19
20
21
# File 'lib/puppet/util/platform.rb', line 17

def default_paths
  return [] if windows?

  %w{/usr/sbin /sbin}
end

.fips_enabled?Boolean


39
40
41
# File 'lib/puppet/util/platform.rb', line 39

def fips_enabled?
  @fips_enabled
end

.jruby?Boolean


44
45
46
# File 'lib/puppet/util/platform.rb', line 44

def self.jruby?
  RUBY_PLATFORM == 'java'
end

.jruby_fips?Boolean


48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/puppet/util/platform.rb', line 48

def jruby_fips?
  @@jruby_fips ||= if RUBY_PLATFORM == 'java'
                     require 'java'

                     begin
                       require 'openssl'
                       false
                     rescue LoadError, NameError
                       true
                     end
                   else
                     false
                   end
end

.windows?Boolean


7
8
9
10
11
12
13
14
# File 'lib/puppet/util/platform.rb', line 7

def windows?
  # Ruby only sets File::ALT_SEPARATOR on Windows and the Ruby standard
  # library uses that to test what platform it's on. In some places we
  # would use Puppet.features.microsoft_windows?, but this method can be
  # used to determine the behavior of the underlying system without
  # requiring features to be initialized and without side effect.
  !!File::ALT_SEPARATOR
end