Module: Puppet::Util::Platform

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

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.default_pathsObject



24
25
26
27
28
# File 'lib/puppet/util/platform.rb', line 24

def default_paths
  return [] if windows?

  %w[/usr/sbin /sbin]
end

.fips_enabled?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/puppet/util/platform.rb', line 46

def fips_enabled?
  @fips_enabled
end

.jruby?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/puppet/util/platform.rb', line 51

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

.jruby_fips?Boolean

Returns:

  • (Boolean)


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

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)


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

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

.windows?Boolean

Returns:

  • (Boolean)


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

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