Tweak RabbitMQ version check to allow 3.13 to 4.1

Since RabbitMQ 4.1 supports the upgrade from 3.13 [1],
the assert condition and ``upgrade_version`` was adjusted accordingly.

[1] https://www.rabbitmq.com/docs/upgrade#rabbitmq-version-upgradability

Change-Id: I86eb058f88b49fcbbc4e219d5329aa6f0a339b95
Closes-Bug: #2118452
Signed-off-by: Seunghun Lee <seunghun@stackhpc.com>
This commit is contained in:
Seunghun Lee
2025-07-24 13:59:05 +01:00
parent 068e10f35a
commit cca5ecf050
2 changed files with 11 additions and 3 deletions

View File

@@ -50,12 +50,13 @@
new_version_major: "{{ rabbitmq_version_new.stdout | regex_search('^[0-9]+') }}"
new_version_minor: "{{ rabbitmq_version_new.stdout | regex_search('(?<=.)[^.].') }}"
new_version: "{{ rabbitmq_version_new.stdout | regex_replace('.[^.]+$', '') }}"
# Note: this assumes 3.13 will be the last release before 4.0.
upgrade_version: "{{ '4.0' if current_version == '3.13' else current_version_major + '.' + (current_version_minor | int + 1) | string }}"
# Note: 3.13 is the last release before 4.0.
upgrade_version: "{{ '4.0 or 4.1' if current_version == '3.13' else current_version_major + '.' + (current_version_minor | int + 1) | string }}"
assert:
that: (current_version_major == new_version_major and
new_version_minor | int - current_version_minor | int <= 1) or
(new_version | float == 4.0 and current_version | float == 3.13)
(new_version | float == 4.0 and current_version | float == 3.13) or
(new_version | float == 4.1 and current_version | float == 3.13)
fail_msg: >
Looks like you're trying to run a skip-release upgrade!
RabbitMQ must be at most one version behind the target release version ({{ rabbitmq_version_new.stdout | trim }}) to run this upgrade.

View File

@@ -0,0 +1,7 @@
---
fixes:
- |
Fixes bug `LP#2118452 <https://bugs.launchpad.net/kolla-ansible/+bug/2118452>`__
which stopped the RabbitMQ upgrade from version 3.13 to 4.1 even though it
is supported.