fix ironic driver data structure usage

The template would previously split strings so you'd get things like

enabled_hardware_types = p,x,e

Now we use jmespath to do the search of the lists/dicts for us.

Change-Id: I3f2f4550ed47b78c20d603d77124609c1ec2a63d
This commit is contained in:
Matthew Thode 2018-08-07 15:26:16 -05:00
parent c239816347
commit 0f362e5e7b
No known key found for this signature in database
GPG Key ID: 64A37BEAAE19A4E8
3 changed files with 11 additions and 10 deletions

View File

@ -74,7 +74,7 @@ ironic_services:
ironic-oneviewd: ironic-oneviewd:
group: ironic_conductor group: ironic_conductor
service_name: ironic-oneviewd service_name: ironic-oneviewd
service_en: "{{ 'oneview' in filtered_ironic_drivers.hardware_type }}" service_en: "{{ 'oneview' in (filtered_ironic_drivers | json_query('[*].hardware_type') | unique) }}"
init_config_overrides: "{{ ironic_oneviewd_init_config_overrides }}" init_config_overrides: "{{ ironic_oneviewd_init_config_overrides }}"

View File

@ -16,12 +16,13 @@ default_network_interface = {{ ironic_default_network_interface }}
transport_url = {{ ironic_oslomsg_rpc_transport }}://{% for host in ironic_oslomsg_rpc_servers.split(',') %}{{ ironic_oslomsg_rpc_userid }}:{{ ironic_oslomsg_rpc_password }}@{{ host }}:{{ ironic_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ ironic_oslomsg_rpc_vhost }}{% if ironic_oslomsg_rpc_use_ssl | bool %}?ssl=1{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} transport_url = {{ ironic_oslomsg_rpc_transport }}://{% for host in ironic_oslomsg_rpc_servers.split(',') %}{{ ironic_oslomsg_rpc_userid }}:{{ ironic_oslomsg_rpc_password }}@{{ host }}:{{ ironic_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ ironic_oslomsg_rpc_vhost }}{% if ironic_oslomsg_rpc_use_ssl | bool %}?ssl=1{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
# drivers # drivers
enabled_hardware_types = {{ filtered_ironic_drivers.hardware_type | join(',') }} enabled_hardware_types = {{ filtered_ironic_drivers | json_query('[*].hardware_type') | unique | join(',') }}
enabled_boot_interfaces = {{ filtered_ironic_drivers.boot | join(',') }} enabled_boot_interfaces = {{ filtered_ironic_drivers | json_query('[*].boot') | unique | join(',') }}
enabled_deploy_interfaces = {{ filtered_ironic_drivers.deploy | join(',') }} enabled_deploy_interfaces = {{ filtered_ironic_drivers | json_query('[*].deploy') | unique | join(',') }}
enabled_inspect_interfaces = {{ filtered_ironic_drivers.inspect | join(',') }} enabled_inspect_interfaces = {{ filtered_ironic_drivers | json_query('[*].inspect') | unique | join(',') }}
enabled_management_interfaces = {{ filtered_ironic_drivers.management | join(',') }} enabled_management_interfaces = {{ filtered_ironic_drivers | json_query('[*].management') | unique | join(',') }}
enabled_power_interfaces = {{ filtered_ironic_drivers.power | join(',') }} enabled_power_interfaces = {{ filtered_ironic_drivers | json_query('[*].power') | unique | join(',') }}
[agent] [agent]
@ -141,7 +142,7 @@ cleaning_network = {{ ironic_neutron_cleaning_network_uuid | default(ironic_neut
{% endif %} {% endif %}
[oneview] [oneview]
{%- if 'oneview' in filtered_ironic_drivers.hardware_type -%} {%- if 'oneview' in (filtered_ironic_drivers | json_query('[*].hardware_type') | unique) -%}
manager_url = {{ ironic_oneview_manager_url }} manager_url = {{ ironic_oneview_manager_url }}
username = {{ ironic_oneview_username }} username = {{ ironic_oneview_username }}
password = {{ ironic_oneview_password }} password = {{ ironic_oneview_password }}

View File

@ -180,10 +180,10 @@ filtered_ironic_services: |-
{{ services }} {{ services }}
filtered_ironic_drivers: |- filtered_ironic_drivers: |-
{% set concat_drivers = {} %} {% set concat_drivers = [] %}
{% for driver in ironic_drivers_enabled %} {% for driver in ironic_drivers_enabled %}
{% if driver in ironic_driver_types.keys() %} {% if driver in ironic_driver_types.keys() %}
{% set _ = concat_drivers.update(ironic_driver_types[driver]) %} {% set _ = concat_drivers.append(ironic_driver_types[driver]) %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{{ concat_drivers }} {{ concat_drivers }}