Allow to extend default ironic_driver_types

This patch implements extra variable that allows to define extra types
for ironic without need to fully override the existing ones.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-os_tempest/+/907180
Change-Id: Ic35dbeae949ba4425a0e352e51de64122b7c13d5
This commit is contained in:
Dmitriy Rabotyagov 2024-01-29 23:52:45 +01:00 committed by Dmitriy Rabotyagov
parent 8a3b336ca3
commit 218724412b
3 changed files with 12 additions and 2 deletions

View File

@ -363,6 +363,9 @@ ironic_drivers_enabled:
- agent_ipmitool - agent_ipmitool
- pxe_ipmitool - pxe_ipmitool
# extra driver types defined by user
ironic_user_driver_types: {}
ironic_inspector_developer_mode: false ironic_inspector_developer_mode: false
ironic_inspector_venv_python_executable: "{{ openstack_venv_python_executable | default('python2') }}" ironic_inspector_venv_python_executable: "{{ openstack_venv_python_executable | default('python2') }}"

View File

@ -0,0 +1,6 @@
---
features:
- |
Added variable ``ironic_user_driver_types`` that allow to extend
the default ``ironic_driver_types`` as well as override existing
default records.

View File

@ -332,9 +332,10 @@ filtered_ironic_drivers: |-
{% else %} {% else %}
{% set concat_drivers = [] %} {% set concat_drivers = [] %}
{% endif %} {% endif %}
{% set _driver_types = ironic_driver_types | combine(ironic_user_driver_types, recursive=True) %}
{% for driver in ironic_drivers_enabled %} {% for driver in ironic_drivers_enabled %}
{% if driver in ironic_driver_types.keys() %} {% if driver in _driver_types.keys() %}
{% set _ = concat_drivers.append(ironic_driver_types[driver]) %} {% set _ = concat_drivers.append(_driver_types[driver]) %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{{ concat_drivers }} {{ concat_drivers }}