Class: MintPress::OracleJava::Installation

Inherits:
Object
  • Object
show all
Includes:
MintLogger, Mixins::Backgroundable, Mixins::Properties
Defined in:
src/oracle-java/lib/oracle-java/installation.rb

Overview

Base class for Installation of Oracle Java software. Provides methods for the installation and configuration management of Oracle Java.

Since:

  • 0.1.0

Properties (Read/Write)

  • #name ⇒ String (Default Value: self.class.to_s.gsub('::',''))

    Property Attributes
    • defaultself.class.to_s.gsub('::','')
    
    
    71
    # File 'src/oracle-java/lib/oracle-java/installation.rb', line 71
    
    property :Name, type: String, default: self.class.to_s.gsub('::','')
  • #host ⇒ MintPress::Infrastructure::Host (Default Value: Proc.new { r = nil if self.get_property(:parent) and self.get_property(:parent).respond_to?(:get_property) and self.get_property(:parent).get_property(:host) r = self.parent.host elsif self.get_property(:default_localhost) r = MintPress::Infrastructure::Localhost.new(final_user: self.default_localhost_user) end r })
    If the user specifies transport, default to a new host with it, otherwise try parent... we'll raise exception if none of this stuff ends up resolving... why get_property? because parent may not be defined... getproperty wont exception, but self.xxx will! Also: Eagle eyed readers will note the use of disable_proc here, that's because if you set _neither_ of these, you get an infinite loop attempting to around and around - we use disable_proc to break that loop!

    Property Attributes
    • defaultProc.new { r = nil if self.get_property(:parent) and self.get_property(:parent).respond_to?(:get_property) and self.get_property(:parent).get_property(:host) r = self.parent.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
    • cached_proctrue
    
    
    80
    81
    82
    83
    84
    85
    86
    87
    88
    # File 'src/oracle-java/lib/oracle-java/installation.rb', line 80
    
    property :host, type: MintPress::Infrastructure::Host, default: Proc.new { 
      r = nil
      if self.get_property(:parent) and self.get_property(:parent).respond_to?(:get_property) and self.get_property(:parent).get_property(:host)
        r = self.parent.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, cached_proc: true
  • #java_home ⇒ Pathname (Default Value: '/oracle/app/java')
    Location to install the java binaries

    Property Attributes
    • fromString
    • requiredtrue
    • default'/oracle/app/java'
    
    
    98
    # File 'src/oracle-java/lib/oracle-java/installation.rb', line 98
    
    property :java_home, type: Pathname, from: String, required: true, default: '/oracle/app/java'
  • #version ⇒ String
    Which version to install

    Property Attributes
    • requiredtrue
    
    
    100
    # File 'src/oracle-java/lib/oracle-java/installation.rb', line 100
    
    property :version, type: String, required: true
  • #owner ⇒ String
    The user to run the installation as - this will default to the current user

    Property Attributes
    
    
    102
    # File 'src/oracle-java/lib/oracle-java/installation.rb', line 102
    
    property :owner, type: String
  • #group ⇒ String
    The group to run the installation as - this will default to the primary group of the current user

    Property Attributes
    
    
    104
    # File 'src/oracle-java/lib/oracle-java/installation.rb', line 104
    
    property :group, type: String
  • #software_stage ⇒ Pathname
    Where to install java from - for example, "/oracle/stage/jdk-8u192-linux-x64.tar.gz". If this file does not exist on the host where the installation is taking place, but does exist on host where the control is taking place, it will be transfered there

    Property Attributes
    • fromString
    • requiredtrue
    
    
    107
    # File 'src/oracle-java/lib/oracle-java/installation.rb', line 107
    
    property :software_stage, type: Pathname, from: String, required: true
  • #target_tmp_dir ⇒ String (Default Value: '/tmp')
    Which folder to use for tmp - defaults to /tmp

    Property Attributes
    • default'/tmp'
    
    
    109
    # File 'src/oracle-java/lib/oracle-java/installation.rb', line 109
    
    property :target_tmp_dir, type: String, default: '/tmp'
  • #execute_before ⇒ String (Default Value: nil)
    'Accepts commands or script that will be executed before installation.'

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

    Property Attributes
    • defaultnil
    
    
    120
    # File 'src/oracle-java/lib/oracle-java/installation.rb', line 120
    
    property :execute_after, type: String, default: nil, description: 'Accepts commands or script that will be executed after installation.'

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 collapse

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::Backgroundable

#backgroundable, #wait_for_background_tasks

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

Constructor Details

#initialize(opts = {}) ⇒ MintPress::OracleJava::Installation

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

Parameters:

  • opts (Hash) (defaults to: {})
    A Hash of options with which to instantiate this class
  • transport (LASRpcUtils::Transport)
    The transport to use for installing and configuring the software

Options Hash (opts):

  • :java_home (String)
    the java_home software location
  • :version (String)
    the java software version (e.g. 1.8.0_172)
  • :owner (String)
    the OS owner UID of the java software
  • :group (String)
    the OS group GID of the java software
  • :software_stage (String)
    the location on the target where the software can be installed from
  • :target_tmp_dir (String)
    the location on the target to be used as a temporary directory

Raises:

  • (ArgumentError)
    invalid argument passed into constructor

Since:

  • 0.1.0

Instance Attribute Details

#:java_homeString

the location path for where the Java software installation is to be installed

Returns:

  • (String)
    the current value of :java_home

#:transportLASRpcUtils::Transport

the transport to use when installing the software

Returns:

#:versionString

a compliant string listing the java version (e.g. 1.8.0_172)

Returns:

  • (String)
    the current value of :version

Instance Method Details

#background_installObject

Since:

  • 0.1.0

#clobbervoid

This method returns an undefined value.

Clobber or delete/remove an installation of the software on the target version if exists

Since:

  • 0.1.0

#execute_script(script, stage, transport) ⇒ Object

Helper function to Execute script before or after a patch or install stage can be before or after

Since:

  • 0.1.0

#exists?TrueClass, FalseClass

Determines whether the software has already been installed and exists on the target

Returns:

  • (TrueClass, FalseClass)
    whether the software exists on the target

Since:

  • 0.1.0

#get_property_from_target(name) ⇒ Object

Grab properties from the remote - thinking specifically version

Since:

  • 0.1.0

#installvoid

This method returns an undefined value.

Perform the install of the software on the target version if it does not already exist

Since:

  • 0.1.0

#installed_versionString

Determines the version installed on the target system

Returns:

  • (String)
    the version of the software installed on the target

Since:

  • 0.1.0

#uninstallvoid

TODO:
Add support for uninstallation or removal of Oracle Java software. Method not implemented

This method returns an undefined value.

Perform an uninstall of the software on the target version if exists

Since:

  • 0.1.0

#updatevoid

TODO:
Add support for update of Oracle Java software. Method not implemented

This method returns an undefined value.

Update the version of Java software on the target to the version specified in the constructor. If the java version specified in the constructor is different to the version installed on the target, update the installation to match the version in the constructor.

Since:

  • 0.1.0

#usageString

Example usage of the class

Returns:

Since:

  • 0.1.0

#version_numeric(version) ⇒ Object

Since:

  • 0.1.0