Ensure nova_device_spec is templated as JSON string
When the nova_device_spec variable is provided as either a string or a mapping, ensure that it's templated as a JSON string. Also handle either strings or mappings within nova_device_spec if it's provided as a list. Closes-Bug: 2057961 Change-Id: I7041a19547af580408ff704578cb8f12d37da1ae
This commit is contained in:
parent
bfa8e12fcc
commit
501cf14342
@ -342,11 +342,17 @@ device_addresses = {{ (record.address is string) | ternary(record.address, recor
|
||||
[pci]
|
||||
{% if nova_device_spec %}
|
||||
# PCI devices available to VMs
|
||||
{% if nova_device_spec is mapping %}
|
||||
{% if nova_device_spec is string %}
|
||||
device_spec = {{ nova_device_spec }}
|
||||
{% elif nova_device_spec is mapping %}
|
||||
device_spec = {{ nova_device_spec | to_json }}
|
||||
{% else %}
|
||||
{% for item in nova_device_spec %}
|
||||
{% if item is string %}
|
||||
device_spec = {{ item }}
|
||||
{% elif item is mapping %}
|
||||
device_spec = {{ item | to_json }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user