Class: MintPress::OracleWeblogic::Patch

Inherits:
Object
  • Object
show all
Includes:
MintLogger, Mixins::Properties, Utils
Defined in:
src/oracle-weblogic/lib/oracle-weblogic/patch.rb

Overview

Apply an Oracle OPatch style of patch - now that this will currently _not_ work for BSU style patches

Since:

  • 0.1.0

Direct Known Subclasses

MintPress::OracleDatabaseClient::Patch

Properties (Read/Write)

  • #name ⇒ String
    Name of the patch. This is often, but not always, the same as the ARU. It's primarily used as an internal identifier

    Property Attributes
    • requiredtrue
    • fromInteger
    
    
    111
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 111
    
    property :name, type: String, required: true, from: Integer
  • #aru ⇒ String (Default Value: Proc.new { self.name })
    ARU of the patch - this is usually numeric. THis defaults to the name, if not specified.

    Property Attributes
    • fromInteger
    • defaultProc.new { self.name }
    
    
    113
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 113
    
    property :aru, type: String, from: Integer, default: Proc.new { self.name }
  • #stage ⇒ Pathname (Default Value: Proc.new { find_in_super([:stage, :software_stage]) })
    The location of the patch, _not including the aru_. If it is a part of a patchset, the location will be traken from there. If there is an installation object, this will default to the stage of that installation.

    Property Attributes
    • fromString
    • defaultProc.new { find_in_super([:stage, :software_stage]) }
    
    
    115
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 115
    
    property :stage, type: Pathname, from: String, default: Proc.new { find_in_super([:stage, :software_stage]) }
  • #target_oracle_home ⇒ Pathname (Default Value: Proc.new { Pathname.new(find_in_super([:target_oracle_home, :fmw_home])) })
    ORACLE_HOME to which to apply the patch. This is derived from our parent patchset of installation, if available

    Property Attributes
    • fromString
    • defaultProc.new { Pathname.new(find_in_super([:target_oracle_home, :fmw_home])) }
    
    
    117
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 117
    
    property :target_oracle_home, type: Pathname, from: String, default: Proc.new { Pathname.new(find_in_super([:target_oracle_home, :fmw_home])) }
  • #listcmd ⇒ String (Default Value: "lspatches")
    OPatch subcommand to use for listing patches. It's not advised to change this from the default.

    Property Attributes
    • default"lspatches"
    
    
    120
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 120
    
    property :listcmd, type: String, default: "lspatches"
  • #applycmd ⇒ String (Default Value: "napply -skip_duplicate -skip_subset")
    OPatch subcommand to use for applying patches. It is not advised to change this from the default.

    Property Attributes
    • default"napply -skip_duplicate -skip_subset"
    
    
    122
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 122
    
    property :applycmd, type: String, default: "napply -skip_duplicate -skip_subset"
  • #optional_args ⇒ String (Default Value: "")
    Optional arguments to pass to the opatch binary

    Property Attributes
    • default""
    
    
    124
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 124
    
    property :optional_args, type: String, default: ""
  • #fmw_home ⇒ Pathname (Default Value: Proc.new { find_in_super(:fmw_home) })
    FMW Home to apply the patch to. If this is not specified, it will be derived from either the patchset or the installation objects.

    Property Attributes
    • defaultProc.new { find_in_super(:fmw_home) }
    • fromString
    • alias:oracle_home
    
    
    127
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 127
    
    property :fmw_home, type: Pathname, default: Proc.new { find_in_super(:fmw_home) }, from: String, alias: :oracle_home
  • #java_home ⇒ Pathname (Default Value: Proc.new { find_in_super(:java_home) })
    Java to use for running opatch. If this is not specified, it will be derived from either the patchset or the installation objects.

    Property Attributes
    • defaultProc.new { find_in_super(:java_home) }
    • fromString
    
    
    129
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 129
    
    property :java_home, type: Pathname, default: Proc.new { find_in_super(:java_home) }, from: String
  • #inventory_location ⇒ Pathname (Default Value: Proc.new { find_in_super(:inventory_location) })
    Oracle Inventory location. If this is not specified, it will be derived from either the patchset or the installation objects.

    Property Attributes
    • defaultProc.new { find_in_super(:inventory_location) }
    • fromString
    
    
    131
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 131
    
    property :inventory_location, type: Pathname, default: Proc.new { find_in_super(:inventory_location) }, from: String
  • #target_tmp_dir ⇒ Pathname (Default Value: Proc.new { r=find_in_super(:target_tmp_dir) ; if r.nil? then r=Pathname.new('/tmp/') ; end ; r })
    Temp dir to use. This will default to something sensible in the general case.

    Property Attributes
    • defaultProc.new { r=find_in_super(:target_tmp_dir) ; if r.nil? then r=Pathname.new('/tmp/') ; end ; r }
    • fromString
    
    
    133
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 133
    
    property :target_tmp_dir, type: Pathname, default: Proc.new { r=find_in_super(:target_tmp_dir) ; if r.nil? then r=Pathname.new('/tmp/') ; end ; r }, from: String
  • #version (Default Value: Proc.new { find_in_super(:version) })
    Version of weblogic to which this patch is applying. If this is not specified, it will be derived from either the patchset or the installation objects.

    Property Attributes
    • defaultProc.new { find_in_super(:version) }
    
    
    135
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 135
    
    property :version, default: Proc.new { find_in_super(:version) }
  • #group ⇒ String (Default Value: Proc.new { r=find_in_super(:group) ; if r.nil? then r='oinstall' ; end ; r })
    Unix group to write files as. Defaults to 'oinstall' if not specified.

    Property Attributes
    • defaultProc.new { r=find_in_super(:group) ; if r.nil? then r='oinstall' ; end ; r }
    
    
    137
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 137
    
    property :group, default: Proc.new { r=find_in_super(:group) ; if r.nil? then r='oinstall' ; end ; r }, type: String
  • #opatch_autoupdate_file ⇒ Pathname (Default Value: Proc.new { find_in_super(:opatch_autoupdate_file) })
    Autoupdate file location. If this is not specified, it will be derived from either the patchset or the installation objects.

    Property Attributes
    • defaultProc.new { find_in_super(:opatch_autoupdate_file) }
    • fromString
    
    
    139
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 139
    
    property :opatch_autoupdate_file, default: Proc.new { find_in_super(:opatch_autoupdate_file) }, type: Pathname, from: String
  • #required_opatch_version ⇒ String (Default Value: Proc.new { ov = find_in_super(:required_opatch_version) ov = '13.9.4.0.0' if ov.nil? ov })
    'The minimum opatch version required, if we do not find this version, we will update it using the opatch_autoupdate_file'

    Property Attributes
    • defaultProc.new { ov = find_in_super(:required_opatch_version) ov = '13.9.4.0.0' if ov.nil? ov }
    
    
    142
    143
    144
    145
    146
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 142
    
    property :required_opatch_version, type: String, default: Proc.new {
       ov = find_in_super(:required_opatch_version) 
       ov = '13.9.4.0.0' if ov.nil?
       ov
    }, description: 'The minimum opatch version required, if we do not find this version, we will update it using the opatch_autoupdate_file'
  • #enable_stack_patch_bundle ⇒ [TrueClass, FalseClass] (Default Value: Proc.new { spb = find_in_super(:enable_stack_patch_bundle) spb = false if spb.nil? spb })
    'Set this property if you want to use the Stack Patch Bundle method of applying the patch. Remember that the patch must support SPB method. This is set to false by default'

    Property Attributes
    • defaultProc.new { spb = find_in_super(:enable_stack_patch_bundle) spb = false if spb.nil? spb }
    
    
    149
    150
    151
    152
    153
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 149
    
    property :enable_stack_patch_bundle, type: [TrueClass, FalseClass], default: Proc.new {
       spb = find_in_super(:enable_stack_patch_bundle) 
       spb = false if spb.nil?
       spb
    }, description: 'Set this property if you want to use the Stack Patch Bundle method of applying the patch. Remember that the patch must support SPB method. This is set to false by default'
  • #opatch_base_file ⇒ String (Default Value: Proc.new { # We want to find the value in the installation object and if we cna't find it we want the default to be set bfile = find_in_super(:opatch_base_file) bfile = 'linux64_patchlist.txt' if bfile.nil? bfile })
    'The base file to use for SPB patching, defaults to linux64_patchlist.txt, only applicable if enable_stack_patch_bundle is set to true'

    Property Attributes
    • defaultProc.new { # We want to find the value in the installation object and if we cna't find it we want the default to be set bfile = find_in_super(:opatch_base_file) bfile = 'linux64_patchlist.txt' if bfile.nil? bfile }
    
    
    156
    157
    158
    159
    160
    161
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 156
    
    property :opatch_base_file, type: String, default: Proc.new { 
      # We want to find the value in the installation object and if we cna't find it we want the default to be set
      bfile = find_in_super(:opatch_base_file) 
      bfile = 'linux64_patchlist.txt' if bfile.nil?
      bfile
    }, description: 'The base file to use for SPB patching, defaults to linux64_patchlist.txt, only applicable if enable_stack_patch_bundle is set to true'
  • #host ⇒ MintPress::Infrastructure::Host (Default Value: Proc.new { r = nil if find_in_super(:host) r = find_in_super(:host) elsif self.get_property(:default_localhost) r = MintPress::Infrastructure::LocalHost.new(final_user: self.default_localhost_user) end r })
    Our host is: * installation.host if exists * patchset.host if exists

    Property Attributes
    • defaultProc.new { r = nil if find_in_super(:host) r = find_in_super(:host) elsif self.get_property(:default_localhost) r = MintPress::Infrastructure::LocalHost.new(final_user: self.default_localhost_user) end r }
    • no_backreftrue
    • paralleltrue
    • disposition:requires
    
    
    166
    167
    168
    169
    170
    171
    172
    173
    174
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 166
    
    property :host, type: MintPress::Infrastructure::Host, default: Proc.new {
      r = nil
      if find_in_super(:host)
          r = find_in_super(:host)
      elsif self.get_property(:default_localhost)
        r = MintPress::Infrastructure::LocalHost.new(final_user: self.default_localhost_user)
      end
      r
    }, no_backref: true, parallel: true, disposition: :requires
  • #default_action ⇒ Symbol (Default Value: :apply)
    This is for patch ordering

    Property Attributes
    • default:apply
    • allowed_values[ :apply, :rollback ]
    
    
    183
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 183
    
    property :default_action, type: Symbol, default: :apply, allowed_values: [ :apply, :rollback ]
  • #installation ⇒ [MintPress::OracleWeblogic::Installation,MintPress::OracleDatabaseClient::Installation,MintPress::OracleDatabase::Installation] (Default Value: Proc.new { patchset.installation })
    Allow "patch is applied to installation" way of doing things. If we have a patchset, it defaults to the installation of _that_, but is overridable

    Property Attributes
    • defaultProc.new { patchset.installation }
    
    
    187
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 187
    
    property :installation, type: [MintPress::OracleWeblogic::Installation,MintPress::OracleDatabaseClient::Installation,MintPress::OracleDatabase::Installation], default: Proc.new { patchset.installation }
  • #patchset ⇒ MintPress::OracleWeblogic::PatchSet
    Backreference to any patchset in which we are present

    Property Attributes
    • requiredfalse
    • prop_name:patches
    
    
    190
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 190
    
    property :patchset, type: MintPress::OracleWeblogic::PatchSet, required: false, prop_name: :patches
  • #apply_before ⇒ Array of ⇒ String
    as "apply_before", a list of patch names that must be applied first - this is what you should use if your default action is 'apply' as "rollback_after", a list of patch names that must be applied after this patch - this is what you should use if your default action is 'rollback'

    Property Attributes
    • alias:rollback_after
    
    
    194
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 194
    
    property :apply_before, type: String, array: true, alias: :rollback_after
  • #apply_after ⇒ Array of ⇒ String
    as "apply_after", a list of patch names that must be applied after this patch - this is what you should use if your default action is 'apply' as "rollback_before", a list of patch names that must be applied first - this is what you should use if your default action is 'rollback'

    Property Attributes
    • alias:rollback_before
    
    
    198
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 198
    
    property :apply_after, type: String, array: true, alias: :rollback_before
  • #execute_before ⇒ String (Default Value: nil)
    'Accepts commands or script that will be executed before a patch is applied.'

    Property Attributes
    • defaultnil
    
    
    200
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 200
    
    property :execute_before, type: String, default: nil, description: 'Accepts commands or script that will be executed before a patch is applied.'
  • #execute_after ⇒ String (Default Value: nil)
    'Accepts commands or script that will be executed after a patch is applied.'

    Property Attributes
    • defaultnil
    
    
    201
    # File 'src/oracle-weblogic/lib/oracle-weblogic/patch.rb', line 201
    
    property :execute_after, type: String, default: nil, description: 'Accepts commands or script that will be executed after a patch is applied.'

Properties (Read Only)

Constant Summary

Constants included from MintLogger

MintLogger::DEBUG, MintLogger::ERROR, MintLogger::FATAL, MintLogger::INFO, MintLogger::UNKNOWN, MintLogger::VERBOSE, MintLogger::WARN

Instance Attribute Summary

Attributes included from Mixins::Properties

#autopush_set_cache, #dynamic_create, #harvest_on_access, #harvest_undefined_only, #harvested, #tree_root

Instance Method Summary collapse

Methods included from Mixins::Properties

#[], #[]=, #add_validate_report_result, #armour_set_property, #array_contains?, #array_is_a?, #check_autopush, #check_stack_overflow, #clone_property_object, #cloner_handle_single_property, #coerce_single, #contains_as_string?, #display_validate_report_result, #double_initialize?, #dump_to_hash, #find_parent, #find_parent_by_identity, #generate_accessor_functions, #get_canonical_renamed, #get_from_opts, #get_my_name, #get_property, #get_property_item, #has?, included, #initialize_validate_report, #inspect, #is_cloned_object?, #is_mintpress_object?, #is_probably_canonical?, #is_set?, #local_debug, #local_info, #local_verbose, #mintpress_property_definitions, #place_object_by_identity, #process_properties, #prop_set?, #property, #property_definitions, #property_details, #property_is_simple_object?, #push_root!, #require_property, #require_update, #retrieve_docstring, #sanitize, #set_map_dirty, #set_property, #set_property_item, #show_short_array, #strip_defaults!, #synchronize, #uncloned_property_definitions, #update_map, #validate, #validate_generic, #validate_properties, #validate_property, #validate_required, #version_allowed?, #weakref

Methods included from MintLogger::Utils::Common

#boolean_val, #has_value?, #no_value?, #nvl, #path_as_symbol, #ruby_level_to_send

Methods included from Utils

#activate_list, #already_traversed, #announce_self, #bean_type, #build_activate_list, #clear_property_sheet_cache, #create_generic, #create_mbean_components, #delete, #destroy_generic, #execute_script, #fast_ls_all, #fast_ls_folder, #fast_ls_object, #fast_ls_object_map, #find_cluster, #find_runtime_path_in_rest, #find_server, #full_url, #get, #get_all_self_names, #get_identity, #get_local_wlst_session, #get_matching_self_names, #get_property_from_target, #get_property_from_target_rest, #get_property_from_target_wlst, #get_property_from_target_wlst_impl, #get_property_sheet, #get_rest_item, #get_rest_url_for_parent, #get_rest_url_for_self, #get_servers, #get_servers_rest, #get_servers_wlst, #get_wl_home, #globmatch?, #handle_create, #http_delete, #http_get, #http_post, #http_put, included, #invalidate_session, #is_meta_object?, #longclass, #massage_return, #mbean_components, #mbean_exists?, #mbean_lookup, #mbean_properties, #mbean_to_hash, #meta_list?, #my_short_name, #perform_method_generic, #perform_runtime_call_generic_rest, #perform_runtime_method_generic, #post, #raise_http_exception, #remove, #request_headers, #reset_activate_list, #rest_activate_change, #rest_create_generic, #rest_create_mbean_components, #rest_destroy_self, #rest_edit_url, #rest_has_changes, #rest_idempotent_create, #rest_locked, #rest_nonedit_url, #rest_start_change, #rest_undo_change, #runtime_introspection, #shortclass, #start_with_async, #state_with_net_ping, #stop_with_async, #to_nested, #wlst_cd_to, #wlst_create_generic, #wlst_destroy_self, #wlst_find_object, #wlst_find_parent_object, #wlst_generic_mbean_update_all, #wlst_idempotent_create, #wlst_update_mbean

Constructor Details

#initialize(opts) ⇒ MintPress::OracleWeblogic::Patch

The constructor

Examples:

Install Java

transport_options = {}
transport_options[:user]            = "mintpress"
transport_options[:keys]            = ["~/.ssh/mintpress.key"]
transport_options[:port]            = 22
transport_options[:sudo_user]       = "oracle"
transport_options[:sudo_shell_type] = "su"

transport1=LASRpcUtils::Transport.new('appserver1.mintpress.io', 'ssh', transport_options)

java_opts={
  version: '1.8.0_172',
  java_home: "/oracle/app/java",
  owner: 'oracle',
  group: 'oinstall',
  software_stage: '/oracle/stage/jdk/jdk-8u172-linux-x64.tar.gz'
}

java_installation=MintPress::OracleJava::Installation.new(java_opts, transport: transport1)
java_installation.install

wls_install_opts={
   version: '12.2.1.3',
   java_home: java_opts[:java_home],
   fmw_home: "/oracle/app/#{product}/fmw",
   inventory_location: "/oracle/app/#{product}/oraInventory",
   owner: 'oracle',
   group: 'oinstall',
   software_stage: '/oracle/stage/wls/12.2.1.3/fmw_12.2.1.3.0_wls.jar',
   opatch_autoupdate_file: '/oracle/stage/OPatch/p28186730_139400_Generic.zip'
}

wls_installation=MintPress::OracleWeblogic::Installation.new(wls_install_opts, transport: transport1)

# The patch details
patch_details={ aru: '28298734',
  stage: '/media/stage/fmwinfra/12.2.1.3/patches'
}
# Add patch to configuration
wls_installation.add_patch(patch_details)
# Apply the patch
wls_installation.patches.each { | x | x.apply }

Parameters:

  • opts (Hash)
    A Hash of options with which to instantiate this class

Options Hash (opts):

  • :aru (String)
    the patch number (aru)
  • :stage (String)
    the location path for the patch software
  • :target_oracle_home (String)
    the target ORACLE_HOME to patch (default: fmw_home)
  • :listcmd (String)
    the list command to pass into OPatch utility for listing patches. Default: `lspatches`
  • :applycmd (String)
    the apply command to pass into OPatch utility for applying patches. Default: `napply -skip_duplicate -skip_subset`
  • :optional_args (String)
    the optional arguments to pass into OPatch utility when operating with patches. Default: ``

Raises:

  • (ArgumentError)
    invalid argument passed into constructor

Since:

  • 0.1.0

Instance Method Details

#applyvoid

This method returns an undefined value.

Apply the patch using OPatch utility

Since:

  • 0.1.0

#empty_mbean?(empty_stack: []) ⇒ Boolean

Always return true for empty_mbean for installations - it absoutely has no mbeans!

Returns:

  • (Boolean)

Since:

  • 0.1.0

#exists?TrueClass, FalseClass

Detemine whether the patch has been applied to the OracleWeblogic::Installation with the OPatch utility

Returns:

  • (TrueClass, FalseClass)

Since:

  • 0.1.0

#find_in_super(iprop) ⇒ Object

Since:

  • 0.1.0

#get_opatch_versionString

Obtain the version of the OPatch utility installed on the target Installation

Returns:

  • (String)
    the version of OPatch installed

Since:

  • 0.1.0

#get_opatch_version_numeric(opatch_version) ⇒ Integer

Obtain the version of the OPatch utility installed on the target Installation

Parameters:

  • opatch_version (String)
    The version of OPatch

Returns:

  • (Integer)
    the numeric equivalent version of OPatch installed in order to perform numeric equivalence testing

Since:

  • 0.1.0

#get_stage_opatch_version_db(opatch_file = "") ⇒ String

Obtain the version of the OPatch patch from stage patch file

Returns:

  • (String)
    the version of the OPatch in the stage

Since:

  • 0.1.0

#not_already_calling?(prop, obj: self) ⇒ Boolean

Check that find_in_super did not put us in a proc loop!

Returns:

  • (Boolean)

Since:

  • 0.1.0

#product_is_db?Boolean

Returns:

  • (Boolean)

Since:

  • 0.1.0

#product_is_fmw?Boolean

Returns:

  • (Boolean)

Since:

  • 0.1.0

#rollbackvoid

This method returns an undefined value.

Rollback the patch using OPatch utility

Since:

  • 0.1.0

#update_opatch(opatch_file: nil) ⇒ void

This method returns an undefined value.

Update the OPatch utility to the latest version specified in the opatch_file

Parameters:

  • opatch_file (String) (defaults to: nil)
    File location of the latest OPatch utility to update to

Since:

  • 0.1.0

#usageString

Example usage of the class

Returns:

Since:

  • 0.1.0

#version_numericObject

Since:

  • 0.1.0