Replace deprecated is_string method

... and simplify how $::os_service_default, which is a String, is
handled.

Closes-Bug: #1939088
Change-Id: Iafb03a6cd57859d11713d12b1c939a9fe782ee65
This commit is contained in:
Takashi Kajinami 2021-08-06 10:39:01 +09:00
parent 71e3c3d5e8
commit 8f6788f10f

View File

@ -32,24 +32,20 @@ define oslo::messaging::notifications(
$transport_url = $::os_service_default,
$topics = $::os_service_default,
) {
if is_service_default($driver) or is_string($driver) {
# When we have a string value for driver, we keep passing it as string
# to reduce any chance of breaking things in a backwards incompatible way
$driver_orig = $driver
} else {
$driver_orig = any2array($driver)
# When we have a string value for driver, we keep passing it as string
# to reduce any chance of breaking things in a backwards incompatible way
$driver_real = $driver ? {
String => $driver,
default => any2array($driver)
}
if !is_service_default($topics) {
$topics_orig = join(any2array($topics), ',')
} else {
$topics_orig = $topics
}
$topics_real = join(any2array($topics), ',')
$notification_options = {
'oslo_messaging_notifications/driver' => { value => $driver_orig },
'oslo_messaging_notifications/driver' => { value => $driver_real },
'oslo_messaging_notifications/transport_url' => { value => $transport_url, secret => true },
'oslo_messaging_notifications/topics' => { value => $topics_orig },
'oslo_messaging_notifications/topics' => { value => $topics_real },
}
create_resources($name, $notification_options)