puppet-nova/manifests/pci.pp
Takashi Kajinami f8bde51891 pci: Drop support for "broken" json
JSON does not allow usage of single quotes and require double quotes.
We have been converting single quotes to support such invalid usage but
that was deprecated a long ago[1].

This also simplifies the logic to handle aliases. Using undef results
in the value set to service default fact.

[1] 1cd349f893

Change-Id: If1328531f33a9fe778091ce38b5c1f8072b473b8
2023-11-03 23:11:29 +09:00

28 lines
661 B
Puppet

# Class nova::pci
#
# Configures nova pci options
#
# === Parameters:
#
# [*aliases*]
# (optional) A list of pci alias hashes
# Defaults to $facts['os_service_default']
# Example:
# [{"vendor_id" => "1234", "product_id" => "5678", "name" => "default"},
# {"vendor_id" => "1234", "product_id" => "6789", "name" => "other"}]
class nova::pci(
$aliases = $facts['os_service_default']
) {
include nova::deps
if !is_service_default($aliases) and !empty($aliases) {
$aliases_real = to_array_of_json_strings($aliases)
} else {
$aliases_real = $facts['os_service_default']
}
nova_config {
'pci/alias': value => $aliases_real;
}
}