Module: OracleFeature

Includes:
PuppetX::EnterpriseModules::Oracle::Access, PuppetX::EnterpriseModules::Oracle::Information, PuppetX::EnterpriseModules::Oracle::Settings
Defined in:
lib/puppet/feature/oracle11.rb,
lib/puppet/feature/oracle12.rb,
lib/puppet/feature/oratab_exists.rb,
lib/puppet/feature/oracle_running.rb

Overview

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

Class Method Summary collapse

Methods included from PuppetX::EnterpriseModules::Oracle::Information

#cached_sid_value, #cluster?, #cluster_instances, #containerdb?, #database_properties, #database_version, #db_create_file_dest, #db_domain, #db_for, #diagnostic_dest, included, #local_sid_for_db, #open_pdbs, #oracle_major_version, #oracle_managed_files_enabled?, #pdb?, #primary?, #rootdb?, #seeddb?, #sid_for, #value_for_init_param

Methods included from PuppetX::EnterpriseModules::Oracle::Settings

#asm_sid?, #asm_sids, #configuration, #configuration_for, #configuration_value_for, #container_db?, #database_sid?, #database_sids, #default_asm_sid, #default_database_sid, #default_sids, included, #local_pdb?, #mgmt_sid?, #mgmt_sids, #normal_db?, #num_default_asm_sids, #num_default_database_sids, #read_from_yaml, #registered_sids, #remote_sid?, #running_asm_sids, #running_database_sids, #running_db?, #running_mgmt_sids, #running_mt_database_sids, #running_nopdb_database_sids, #running_normal_database_sids, #running_pdb?, #running_primary_database_sids, #running_sids, #settings_file, #valid_asm_sid?, #valid_database_sid, #valid_sid?

Methods included from PuppetX::EnterpriseModules::Oracle::Access

#add_sid_to, #for_version, #hex_to_raw, included, #instance, #module_name, #ora_autorequire, #oracle_version?, #resource_list_for, #rman, #rman_on_all_database_sids, #rman_on_sids, #safe_sql, #select_statement, #sid_from, #sid_from_resource, #sql, #sql_on_all_asm_sids, #sql_on_all_database_sids, #sql_on_all_mgmt_sids, #sql_on_all_mt_sids, #sql_on_all_normal_sids, #sql_on_all_primary_database_sids, #sql_on_all_sids, #sql_on_sids, #timeout_specified, #versioned_statement?

Class Method Details

.oracle11_checkObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/puppet/feature/oracle11.rb', line 27

def self.oracle11_check
  Puppet.debug 'Feature oracle11 checking availability'
  Puppet.debug "Feature oracle11 sid is '#{sid}'"
  Puppet.debug "Feature oracle11 database version is #{database_version}"

  if sid && /^11.*$/.match(database_version)
    Puppet.debug 'Feature oracle11 available'
    true
  else
    Puppet.debug 'Feature oracle11 **NOT** available'
    false
  end
rescue StandardError => e
  Puppet.debug e # Show the generated error
  Puppet.debug 'Feature oracle11 **NOT** available'
  false
end

.oracle12_checkObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/puppet/feature/oracle12.rb', line 27

def self.oracle12_check
  Puppet.debug 'Feature oracle12 checking availability'
  Puppet.debug "Feature oracle12 sid is '#{sid}'"
  Puppet.debug "Feature oracle12 database version is #{database_version}"

  if sid && (/^1[289].*$/.match(database_version) || /^2[01].*$/.match(database_version))
    Puppet.debug 'Feature oracle 12, 18, 19, 20 or 21 available'
    true
  else
    Puppet.debug 'Feature oracle12 **NOT** available'
    false
  end
rescue StandardError => e
  Puppet.debug e # Show the generated error
  Puppet.debug 'Feature oracle12 **NOT** available'
  false
end

.oracle_running_checkObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/puppet/feature/oracle_running.rb', line 7

def self.oracle_running_check
  Puppet.debug 'Feature oracle_running checking availability'
  proc = if Facter.value(:kernel) == 'windows'
           `tasklist | findstr oracle.exe`
         else
           Puppet::Util::Execution.execute('ps -ef | egrep "(ora|xe)_pmon.*$"', :failonfail => false, :combine => true)
         end
  if proc == ''
    Puppet.debug 'Feature oracle_running **NOT** available'
    false
  else
    Puppet.debug 'Feature oracle_running available'
    true
  end
end

.oratab_existsObject



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/puppet/feature/oratab_exists.rb', line 29

def self.oratab_exists
  Puppet.debug 'Feature oratab_exists checking availability'

  if File.exist?(oratab_file)
    Puppet.debug 'Feature oratab_exists available'
    true
  else
    Puppet.debug 'Feature oratab_exists **NOT** available'
    false
  end
end

.oratab_fileObject

rubocop:enable Style/Documentation



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/puppet/feature/oratab_exists.rb', line 16

def self.oratab_file
  case Facter.value(:osfamily)
  when 'RedHat', 'AIX', 'Suse'
    '/etc/oratab'
  when 'Solaris'
    '/var/opt/oracle/oratab'
  when 'windows'
    "#{Facter.value(:system32)}\\drivers\\etc"
  else
    fail 'error unsupported OS'
  end
end

.sidObject



23
24
25
# File 'lib/puppet/feature/oracle11.rb', line 23

def self.sid
  default_database_sid.nil? ? running_normal_database_sids.first : default_database_sid
end