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



22
23
24
25
26
# File 'lib/puppet/util/platform.rb', line 22

def default_paths
  return [] if windows?

  %w{/usr/sbin /sbin}
end

.fips_enabled?Boolean

Returns:

  • (Boolean)


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

def fips_enabled?
  @fips_enabled
end

.jruby?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/puppet/util/platform.rb', line 49

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

.jruby_fips?Boolean

Returns:

  • (Boolean)


53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/puppet/util/platform.rb', line 53

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

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

.solaris?Boolean

Returns:

  • (Boolean)


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

def solaris?
  RUBY_PLATFORM.include?('solaris')
end

.windows?Boolean

Returns:

  • (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