Puppet Function: mq_install::version_upgrade

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

Overview

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

Function to determine if we are changing to version with a different major or minor version.

Parameters:

  • current_version (String)

    The currently installed MQ version.

  • requested_version (String)

    The requested MQ version.

Returns:

  • (Boolean)

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



4
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
31
32
# File 'lib/puppet/functions/mq_install/version_upgrade.rb', line 4

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

  def version_upgrade(current_version, requested_version)
    return false if current_version == 'not-installed'

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

    fail "MQ doesn't support a downgrade on running queue managers" if current_major > requested_major || current_minor > requested_minor

    return true if requested_major != current_major
    return true if requested_minor != current_minor

    false
  end
end