Class: PuppetX::EnterpriseModules::OraInstall::OpatchCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/puppet_x/enterprisemodules/ora_install/opatch_command.rb

Overview

docs

Constant Summary

Constants inherited from Command

Command::DEFAULT_TIMEOUT, Command::VALID_OPTIONS

Instance Method Summary collapse

Methods inherited from Command

#command_string

Constructor Details

#initialize(options = {}) ⇒ OpatchCommand

Returns a new instance of OpatchCommand.



11
12
13
# File 'lib/puppet_x/enterprisemodules/ora_install/opatch_command.rb', line 11

def initialize(options = {})
  super(:opatch, options)
end

Instance Method Details

#execute(arguments, command_options) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/puppet_x/enterprisemodules/ora_install/opatch_command.rb', line 15

def execute(arguments, command_options)
  if Facter.value(:kernel) == 'windows'
    environment = {}
    oracle_home = command_options[:oracle_home]
    environment[:PATH] = "C:\\Windows\\system32;C:\\Windows;#{oracle_home}\\bin;#{oracle_home}\\OPatch"
    environment[:ORACLE_HOME] = oracle_home
    options = { :failonfail => true, :combine => true, :custom_environment => environment }
  else
    options = { :failonfail => true, :combine => true }
  end
  value = ''
  command = command_string(arguments, command_options)
  Puppet.debug "Executing #{@command} command: #{arguments} as #{os_user}"
  value = Puppet::Util::Execution.execute(command, options)
  raise 'Opatch contained an error' unless value =~ /OPatch completed|OPatch succeeded|opatch auto succeeded|opatchauto succeeded/

  value
end