Puppet Function: wls_install::soa_cluster_configured

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

Overview

wls_install::soa_cluster_configured(String $domain_dir, String $soa_cluster_name)Boolean

This function checks if soa cluster is configured in the specified path.

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

Parameters:

  • domain_dir (String)
  • soa_cluster_name (String)

Returns:

  • (Boolean)


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/puppet/functions/wls_install/soa_cluster_configured.rb', line 9

Puppet::Functions.create_function(:'wls_install::soa_cluster_configured') do
  dispatch :soa_cluster_configured do
    param 'String', :domain_dir
    param 'String', :soa_cluster_name
    return_type 'Boolean'
  end

  def soa_cluster_configured(domain_dir, soa_cluster_name)
    scope = closure_scope
    fact = scope['wls_install_domains']
    if fact.keys.empty?
      call_function('wls_install::log', 'soa_cluster_configured no domains found, return false')
      return false
    else
      fact.each_key do |domain|
        soa = fact[domain]['soa']
        if soa&.include?(soa_cluster_name) && (fact[domain]['path'] == domain_dir)
          call_function('wls_install::log', "soa_cluster_configured cluster found in '#{soa}' in path '#{domain_dir}', return true")
          return true
        end
      end
    end
    call_function('wls_install::log', "soa_cluster_configured no clusters found named '#{soa_cluster_name}' with path '#{domain_dir}', return false")
    false
  end
end