Puppet Function: ora_config::is_cluster

Defined in:
lib/puppet/functions/ora_config/is_cluster.rb
Function type:
Ruby 4.x API

Overview

ora_config::is_cluster(String $sid)Any

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

Function to fetch the fact ora_is_cluster and based on that information decide if the specified sid is a cluster e.g. RAC database or not.

Parameters:

  • sid (String)

Returns:

  • (Any)


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

Puppet::Functions.create_function('ora_config::is_cluster') do
  dispatch :is_cluster do
    param 'String', :sid
    # return_type 'Boolean' TODO: Wait until the Puppet version supporting this, is mainstream
  end
  def is_cluster(sid)
    variable = 'ora_is_cluster'
    if variable_exists?(variable)
      fact_value = closure_scope.lookupvar("::#{variable}")
      fact_value ? call_function('ora_config::on_sid', fact_value, sid) == ['TRUE'] : false
    else
      #
      # This is probably oracle 11. So assume it is not a container db
      #
      false
    end
  end

  # Check if the variable exists without generating a warning
  def variable_exists?(var)
    closure_scope.to_hash.key?(var)
  end
end