Puppet Function: wls_install::wls_physical_patches

Defined in:
lib/puppet/functions/wls_install/wls_physical_patches.rb
Function type:
Ruby 4.x API

Overview

wls_install::wls_physical_patches(Hash $patch_list)Array

This function parses a Hash of patches and looks for resources with sub_patches. If they are there, this function will translate it to the actual list of patches that need to be on the system.

See the file “LICENSE” for the full license governing this code.

Parameters:

  • patch_list (Hash)

Returns:

  • (Array)


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/puppet/functions/wls_install/wls_physical_patches.rb', line 12

Puppet::Functions.create_function(:'wls_install::wls_physical_patches') do
  dispatch :physical_patches do
    param 'Hash', :patch_list
    return_type 'Array'
  end

  def physical_patches(patch_list)
    return [] if patch_list.nil?

    # PE uses a 2.6 like jruby that doesn't support filter_map yet
    # rubocop: disable Performance/MapCompact
    patch_list.keys.collect do |full_patch_id|
      remove = true if patch_list[full_patch_id].key?('ensure') && (patch_list[full_patch_id]['ensure'].to_s == 'absent')
      oracle_home, _patch_id = full_patch_id.split(':')
      sub_patches = patch_list[full_patch_id]['sub_patches']
      if sub_patches
        if remove
          sub_patches.collect { |p| "#{oracle_home}:#{p}:remove" }
        else
          sub_patches.collect { |p| "#{oracle_home}:#{p}" }
        end
      elsif remove
        "#{full_patch_id}:remove"
      else
        full_patch_id
      end
    end.compact.flatten
    # rubocop: enable Performance/MapCompact
  end
end