Puppet Function: mq_install::fixpack_upgrade

Defined in:
lib/puppet/functions/mq_install/fixpack_upgrade.rb
Function type:
Ruby 4.x API

Overview

mq_install::fixpack_upgrade(String $current_version, String $requested_version)Boolean

Function to determine if we need a fixpack upgrade. We do this based on the current version and the requested version

Parameters:

  • current_version (String)

    The currently installed fixpack version.

  • requested_version (String)

    The requested fixpack version.

Returns:

  • (Boolean)

    If current_version is lower than the requested version return true. Else false



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/puppet/functions/mq_install/fixpack_upgrade.rb', line 5

Puppet::Functions.create_function('mq_install::fixpack_upgrade') do
  #
  # See the file "LICENSE" for the full license governing this code.
  #
  #
  # @param current_version The currently installed fixpack version.
  # @param requested_version The requested fixpack version.
  # @return If current_version is lower than the requested version return true. Else false
  #
  dispatch :fixpack_upgrade do
    required_param 'String',  :current_version
    required_param 'String',  :requested_version
    return_type 'Boolean'
  end

  def fixpack_upgrade(current_version, requested_version)
    return true if current_version == 'not-installed'

    current_major, current_minor, = current_version.split('.')
    requested_major, requested_minor, = requested_version.split('.')

    fail 'Incompatible MQ versions specified for fixpack. Major and minor versions need to be same' if current_major != requested_major || current_minor != requested_minor

    Gem::Version.new(requested_version) > Gem::Version.new(current_version)
  end
end