Module: OracleFeature

Includes:
Puppet_X::EnterpriseModules::Oracle::Access, Puppet_X::EnterpriseModules::Oracle::Information, Puppet_X::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 Puppet_X::EnterpriseModules::Oracle::Access

#add_sid_to, #for_version, #hex_to_raw, included, #instance, #module_name, #ora_autorequire, #oracle_version?, #resource_list_for, #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