Class: PuppetX::EnterpriseModules::Oracle::SrvctlCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/puppet_x/enterprisemodules/oracle/srvctl_command.rb

Overview

docs

Instance Attribute Summary

Attributes inherited from Command

#os_user, #password, #sid, #timeout, #username

Instance Method Summary collapse

Methods inherited from Command

#command_string

Methods included from 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 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

Constructor Details

#initialize(options = {}) ⇒ SrvctlCommand

Returns a new instance of SrvctlCommand.



13
14
15
# File 'lib/puppet_x/enterprisemodules/oracle/srvctl_command.rb', line 13

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

Instance Method Details

#execute(arguments) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/puppet_x/enterprisemodules/oracle/srvctl_command.rb', line 17

def execute(arguments)
  # Filter out double '-modifyconfig' and '-n' arguments
  arguments = "#{arguments.split.reject { |a| a.split.any?('-modifyconfig') }.join(' ')} -modifyconfig" if arguments.split.count('-modifyconfig') > 1
  arguments = "#{arguments.split.reject { |a| a.split.any?('-n') }.join(' ')} -n" if arguments.split.count('-n') > 1
  options = { :failonfail => true, :combine => true }
  value = ''
  command = command_string(arguments)
  within_time(@timeout) do
    Puppet.debug "Executing #{@command} command: #{arguments} as #{os_user}"
    value = Puppet::Util::Execution.execute(command, options)
  end
  value
end