From 8f6788f10f9c5df893beda7a2cb3ecfd6ee11ac3 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 6 Aug 2021 10:39:01 +0900 Subject: [PATCH] Replace deprecated is_string method ... and simplify how $::os_service_default, which is a String, is handled. Closes-Bug: #1939088 Change-Id: Iafb03a6cd57859d11713d12b1c939a9fe782ee65 --- manifests/messaging/notifications.pp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/manifests/messaging/notifications.pp b/manifests/messaging/notifications.pp index 9be67ae..d8c471c 100644 --- a/manifests/messaging/notifications.pp +++ b/manifests/messaging/notifications.pp @@ -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)