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 (cherry picked from commit 501cf14342dd5519f064bca2ec999d204c00bc67)
This commit is contained in:
parent
cb97be032d
commit
069f4dcfba
@ -349,11 +349,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…
x
Reference in New Issue
Block a user