Add backwards compatibility of ceph_components format

With [1] we have broken compatibility of potentially provided extra components
config without any notice.

In order to handle this now we fix backwards compatibility along with
adding a deprecation note on the format of ``client``.

[1] https://review.opendev.org/c/openstack/openstack-ansible-ceph_client/+/882827

Closes-Bug: #2047783
Change-Id: I89b67f0f0545d799194d8486a6bb25227279af84
(cherry picked from commit 6bb5f7dcdb)
This commit is contained in:
Dmitriy Rabotyagov 2024-01-02 16:55:03 +01:00 committed by Dmitriy Rabotyagov
parent 602dc5fc04
commit e694b9141b
3 changed files with 18 additions and 3 deletions

View File

@ -159,7 +159,7 @@ configurations need to be added to the user variable file:
- component: gnocchi_api
package: "{{ python_ceph_packages }}"
client:
- '{{ gnocchi_ceph_client }}'
- name: '{{ gnocchi_ceph_client }}'
service: '{{ ceph_gnocchi_service_names }}'

View File

@ -0,0 +1,13 @@
---
deprecations:
- |
Format of ``client`` key inside ``ceph_extra_components`` variable has been
deprecated in favor of a mapping with one required attribute ``name``.
Having ``client`` key defined as a simple list is kept for backwards compatibility
but will be removed in future releases.
fixes:
- |
Backwards compatibility of ``client`` key inside ``ceph_extra_components`` variable
has been fixed to support both a list and a list of mappings.

View File

@ -59,7 +59,7 @@ ceph_extra_components: []
# package:
# - "{{ python_ceph_package }}"
# client:
# - '{{ gnocchi_ceph_client }}'
# - name: '{{ gnocchi_ceph_client }}'
# service: '{{ ceph_gnocchi_service_names }}'
ceph_client_filtered_packages: |-
@ -94,7 +94,9 @@ ceph_client_filtered_clients: |-
(cinder_service_backup_driver is defined and
'ceph' in cinder_service_backup_driver))) %}
{% for client in comp.client %}
{% if client['enabled'] | default(true) | bool %}
{% if client is not mapping %}
{% set _ = clients.append({'name': client}) %}
{% elif client['enabled'] | default(true) | bool %}
{% set _ = clients.append(client) %}
{% endif %}
{% endfor %}